From c250bb0acf03505fe0585897ce662c3cb8b4e563 Mon Sep 17 00:00:00 2001 From: Memona Amir <157165172+MemonaAmirAbdulHaq@users.noreply.github.com> Date: Sun, 8 Feb 2026 00:07:00 +0500 Subject: [PATCH 1/2] Add Go example for schema-transform nested field access --- .../en/documentation/programming-guide.md | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/website/www/site/content/en/documentation/programming-guide.md b/website/www/site/content/en/documentation/programming-guide.md index 13900f3a7ceb..0f1fdbd8df20 100644 --- a/website/www/site/content/en/documentation/programming-guide.md +++ b/website/www/site/content/en/documentation/programming-guide.md @@ -4164,14 +4164,31 @@ as schema fields may have different requirements or restrictions from Go exporte ### 6.6. Using Schema Transforms {#using-schemas} -A schema on a `PCollection` enables a rich variety of relational transforms. The fact that each record is composed of -named fields allows for simple and readable aggregations that reference fields by name, similar to the aggregations in -a SQL expression. - {{< paragraph class="language-go">}} -Beam does not yet support Schema transforms natively in Go. However, it will be implemented with the following behavior. +In Go, schemas are inferred from struct types. You can use schema-aware +PCollections by defining structs and accessing their fields +directly in transforms. The following example demonstrates extracting +a nested field from a schema-aware collection. {{< /paragraph >}} +{{< highlight go >}} +type ShippingAddress struct { + PostCode string `beam:"postCode"` + } +type Purchase struct { + ShippingAddress ShippingAddress `beam:"shippingAddress"` + } +purchases := beam.Create(s, + Purchase{ + ShippingAddress: ShippingAddress{PostCode: "12345"}, + }, + ) +postCodes := beam.ParDo(s, func(p Purchase) string { + return p.ShippingAddress.PostCode +}, purchases) +{{< /highlight >}} + + #### 6.6.1. Field selection syntax The advantage of schemas is that they allow referencing of element fields by name. Beam provides a selection syntax for From 607903d592575db278c640e297b2a6f0304f4d0f Mon Sep 17 00:00:00 2001 From: Memona Amir <157165172+MemonaAmirAbdulHaq@users.noreply.github.com> Date: Wed, 18 Feb 2026 00:16:39 +0500 Subject: [PATCH 2/2] fix: restore deleted schema description and remove incorrect Go example --- .../en/documentation/programming-guide.md | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/website/www/site/content/en/documentation/programming-guide.md b/website/www/site/content/en/documentation/programming-guide.md index 0f1fdbd8df20..aca121f702cf 100644 --- a/website/www/site/content/en/documentation/programming-guide.md +++ b/website/www/site/content/en/documentation/programming-guide.md @@ -4163,30 +4163,16 @@ as schema fields may have different requirements or restrictions from Go exporte {{< /paragraph >}} ### 6.6. Using Schema Transforms {#using-schemas} +A schema on a `PCollection` enables a rich variety of relational transforms. The fact that each record is composed of +named fields allows for simple and readable aggregations that reference fields by name, similar to the aggregations in +a SQL expression. + {{< paragraph class="language-go">}} -In Go, schemas are inferred from struct types. You can use schema-aware -PCollections by defining structs and accessing their fields -directly in transforms. The following example demonstrates extracting -a nested field from a schema-aware collection. +Support for Schema Transforms hasn't been developed for the Go SDK yet. {{< /paragraph >}} -{{< highlight go >}} -type ShippingAddress struct { - PostCode string `beam:"postCode"` - } -type Purchase struct { - ShippingAddress ShippingAddress `beam:"shippingAddress"` - } -purchases := beam.Create(s, - Purchase{ - ShippingAddress: ShippingAddress{PostCode: "12345"}, - }, - ) -postCodes := beam.ParDo(s, func(p Purchase) string { - return p.ShippingAddress.PostCode -}, purchases) -{{< /highlight >}} + #### 6.6.1. Field selection syntax