alxp1982 commented on code in PR #23577:
URL: https://github.com/apache/beam/pull/23577#discussion_r993060476


##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/count/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Count
+//   description: Count example.
+//   multifile: false
+//   context_line: 39
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+        "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements

Review Comment:
   Please check spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/count/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Count
+//   description: Count example.
+//   multifile: false
+//   context_line: 39
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+        "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]

Review Comment:
   Please check spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/max/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Max
+//   description: Max example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s,input)

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/mean/description.md:
##########
@@ -0,0 +1,45 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Mean
+
+You can use Mean transforms to compute the arithmetic mean of the elements in 
a collection or the mean of the values associated with each key in a collection 
of key-value pairs.
+
+```Mean()``` returns a transformation that returns a collection whose content 
is the average of the elements of the input collection. If there are no 
elements in the input collection, 0 is returned.
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.Mean(s, input)
+}
+```
+
+You can use ```MeanPerKey()``` to calculate the mean of the elements 
associated with each unique key.
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.MeanPerKey(s, input)
+}
+```
+
+### Description for example

Review Comment:
   Same comment as for previous topics. Example description needs to be more 
encouraging, invitation for customization and invitation to customize is also 
missing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/mean/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Mean
+//   description: Mean example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s, input)
+
+       debug.Print(s, output)

Review Comment:
   Please add formatting, so the output looks like 'PCollection mean value: '



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/min/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Min
+//   description: Min example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s, input)
+
+       debug.Print(s, output)

Review Comment:
   Please add formatting, so the output looks like 'PCollection min value: '



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/count/description.md:
##########
@@ -0,0 +1,47 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Count
+
+Count to get the total number of elements in different ways.
+
+Counts the number of elements within each aggregation. The Count transform has 
two varieties:
+
+You can count the number of elements in ```PCollection``` with 
```CountElms()```, it will return one element.
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.CountElms(s, input)
+}
+```
+
+You can use ```Count()``` to count how many elements are associated with a 
particular key, the result will be one output for each key.
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.Count(s, input)
+}
+```
+
+### Description for example
+
+Given a list of integers `PCollection`. The `applyTransform()` function 
returns the count of numbers from `PCollection`.

Review Comment:
   This isn't agreed on language. Please check with reviewed doc. And this is 
an example for only one 'count' variety



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/sum/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Sum
+//   description: Sum example.
+//   multifile: false
+//   context_line: 33
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"

Review Comment:
   spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/sum/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Sum
+//   description: Sum example.
+//   multifile: false
+//   context_line: 33
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s, input)
+
+       debug.Print(s, output)

Review Comment:
   Please add formatting so the output looks like 'PCollection sum value: '



##########
learning/tour-of-beam/learning-content/go/common-transforms/filter/example/main.go:
##########
@@ -0,0 +1,65 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Filter
+//   description: Filter example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/filter"

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/motivating-challenge/hint1.md:
##########
@@ -0,0 +1,16 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+You can solve the challenge with this way:

Review Comment:
   To solve this challenge, you may build a pipeline that consists of the 
following steps:



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/max/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Max
+//   description: Max example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/max/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Max
+//   description: Max example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/count/description.md:
##########
@@ -0,0 +1,47 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Count
+
+Count to get the total number of elements in different ways.

Review Comment:
   It is very different from the original language and is unclear.  Please 
check the original document. 



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/mean/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Mean
+//   description: Mean example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"

Review Comment:
   spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/motivating-challenge/description.md:
##########
@@ -0,0 +1,18 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+### Common Transforms motivating challenge
+You are given a `PCollection` constructed from in-memory array of integer 
numbers: `[12, -34, -1, 0, 93, -66, 53, 133, -133, 6, 13, 15]`. Your task is to 
count how many positive even numbers and how many positive odd numbers are 
there. Although there are many ways how to do this try to use different 
transformas introduced in this module.

Review Comment:
   We were asked to work with larger datasets. Let's use either taxi dataset or 
freeways one



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/max/description.md:
##########
@@ -0,0 +1,45 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Max
+
+Max provides a variety of different transforms for computing the maximum 
values in a collection, either globally or for each key.
+
+You can find the global maximum value from the ```PCollection``` by using 
```Max()```
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.Max(s, input)
+}
+```
+
+You can use ```MaxPerKey()``` to calculate the maximum Integer associated with 
each unique key (which is of type String).
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.MaxPerKey(s, input)
+}
+```
+
+### Description for example
+
+Given a list of integers ```PCollection```. The ```applyTransform()``` 
function returns the maximum number from ```PCollection```.

Review Comment:
   Please use encouraging language, such as in other units. An invitation to 
customize an example is missing as well. If we do global max as an example, we 
can invite user to customize it, such as it count elements by key



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/min/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Min
+//   description: Min example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/filter/example/main.go:
##########
@@ -0,0 +1,65 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Filter
+//   description: Filter example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/filter"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+       // List of elements
+    input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The [input] filtered with the applyTransform()
+    output := applyTransform(s, input)

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/max/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Max
+//   description: Max example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s,input)
+
+       debug.Print(s, output)

Review Comment:
   Could you please add formatting so it can be easier to find in the output, 
such as debug.Printf(s,"PCollection has %d elements", output)
   



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/mean/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Mean
+//   description: Mean example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s, input)

Review Comment:
   spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/min/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Min
+//   description: Min example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s, input)

Review Comment:
   Spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/sum/description.md:
##########
@@ -0,0 +1,45 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Sum
+
+You can use Sum transforms to compute the sum of the elements in a collection 
or the sum of the values associated with each key in a collection of key-value 
pairs.
+
+You can use ```Sum()``` to sum the elements of a ```PCollection```.
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.Sum(s, input)
+}
+```
+
+You can use ```SumPerKey()```to calculate the sum Integer associated with each 
unique key.
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.SumPerKey(s, input)
+}
+```
+
+### Description for example
+
+Given a list of integers ```PCollection```. The ```applyTransform()``` 
function returns the sum of numbers from ```PCollection```.

Review Comment:
   Same as previous comments - add an invitation to run the example in the 
playground window, small challenge to return sum value by key



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/min/description.md:
##########
@@ -0,0 +1,45 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Min
+
+Min transforms find the minimum values globally or for each key in the input 
collection.
+
+You can find the global minimum value from the ```PCollection``` by using 
```Min()```
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.Min(s, input)
+}
+```
+
+You can use ```MinPerKey()``` to calculate the minimum Integer associated with 
each unique key (which is of type String).
+
+```
+import (
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/stats"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return stats.MinPerKey(s, input)
+}
+```
+
+### Description for example
+
+Given a list of integers ```PCollection```. The ```applyTransform()``` 
function returns the minimum number from ```PCollection```.

Review Comment:
   Same as previous comments - add an invitation to run the example in the 
playground window, small challenge to return min value by key



##########
learning/tour-of-beam/learning-content/go/common-transforms/aggregation/sum/example/main.go:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Sum
+//   description: Sum example.
+//   multifile: false
+//   context_line: 33
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/stats"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+    // List of elements
+       input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The applyTransform() converts [input] to [output]
+    output := applyTransform(s, input)

Review Comment:
   spacing



##########
learning/tour-of-beam/learning-content/go/common-transforms/filter/description.md:
##########
@@ -0,0 +1,34 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Filter
+
+### Using Filter
+
+PCollection datasets can be filtered using the Filter transform. You can 
create a filter by supplying a predicate and, when applied, filtering out all 
the elements of PCollection that don’t satisfy the predicate.
+
+```
+import (
+       "github.com/apache/fbeam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/transforms/filter"
+)
+
+func ApplyTransform(s beam.Scope, input beam.PCollection) beam.PCollection {
+       return filter.Exclude(s, input, func(element int) bool {
+               return element % 2 == 1
+       })
+}
+```
+
+### Description for example
+
+Given a list of integers , printing even numbers using ```Filter```. The 
```applyTransform()``` function implements a filter in which the logic 
determines the numbers are even.

Review Comment:
   Same as previous comments - add an invitation to run the example in the 
playground window, a small challenge may be working with strings 



##########
learning/tour-of-beam/learning-content/go/common-transforms/filter/example/main.go:
##########
@@ -0,0 +1,65 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Filter
+//   description: Filter example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/filter"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+       // List of elements
+    input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+
+    // The [input] filtered with the applyTransform()
+    output := applyTransform(s, input)
+
+       debug.Print(s, output)

Review Comment:
   Format output to describe what output value is



##########
learning/tour-of-beam/learning-content/go/common-transforms/filter/example/main.go:
##########
@@ -0,0 +1,65 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// beam-playground:
+//   name: Filter
+//   description: Filter example.
+//   multifile: false
+//   context_line: 38
+//   categories:
+//     - Quickstart
+//   complexity: BASIC
+//   tags:
+//     - hellobeam
+
+package main
+
+import (
+       "context"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/log"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx"
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug"
+    "github.com/apache/beam/sdks/v2/go/pkg/beam/transforms/filter"
+)
+
+func main() {
+       ctx := context.Background()
+
+       p, s := beam.NewPipelineWithRoot()
+
+       // List of elements
+    input := beam.Create(s, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

Review Comment:
   Spacing



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to