robertwb commented on code in PR #30003: URL: https://github.com/apache/beam/pull/30003#discussion_r1501143404
########## sdks/python/apache_beam/yaml/examples/README.md: ########## @@ -0,0 +1,48 @@ +# Examples Catalog + +<!-- TOC --> +* [Examples Catalog](#examples-catalog) + * [Wordcount](#wordcount) + * [Transforms](#transforms) + * [Element-wise](#element-wise) + * [Aggregation](#aggregation) +<!-- TOC --> + +This module contains a series of Beam YAML code samples that can be run using +the command: +``` +python -m apache_beam.yaml.main --pipeline_spec_file=/path/to/example.yaml +``` + +## Wordcount +A good starting place is the [Wordcount](wordcount_minimal.yaml) example under +the root example directory. +This example reads in a text file, splits the text on each word, groups by each +word, and counts the occurrence of each word. This is a classic example used in +the other SDK's and shows off many of the functionalities of Beam YAML. + +## Transforms + +Examples in this directory show off the various built-in transforms of the Beam +YAML framework. + +### Element-wise +These examples leverage the built-in mapping transforms including `MapToFields`, +`Filter` and `Explode`. More information can be found about mapping transforms +[here](../docs/yaml_mapping.md). Review Comment: Now that they're live, let's point to the official docs on https://beam.apache.org/documentation/sdks/yaml/ ########## sdks/python/apache_beam/yaml/examples/wordcount_minimal.yaml: ########## @@ -0,0 +1,75 @@ +# coding=utf-8 +# +# 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# Row(output='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# Row(output='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. +# + +# This examples reads from a public file stores on Google Cloud. This +# requires authenticating with Google Cloud, or setting the file in +#`ReadFromText` to a local file. +# +# To set up Application Default Credentials, +# see https://cloud.google.com/docs/authentication/external/set-up-adc for more +# information +# +# This pipeline reads in a text file, maps all words to a value of "1", sums Review Comment: Perhaps intersperse these comments with the code itself? ########## sdks/python/apache_beam/yaml/examples/README.md: ########## @@ -0,0 +1,48 @@ +# Examples Catalog + +<!-- TOC --> +* [Examples Catalog](#examples-catalog) + * [Wordcount](#wordcount) + * [Transforms](#transforms) + * [Element-wise](#element-wise) + * [Aggregation](#aggregation) +<!-- TOC --> + +This module contains a series of Beam YAML code samples that can be run using +the command: +``` +python -m apache_beam.yaml.main --pipeline_spec_file=/path/to/example.yaml +``` + +## Wordcount +A good starting place is the [Wordcount](wordcount_minimal.yaml) example under +the root example directory. +This example reads in a text file, splits the text on each word, groups by each +word, and counts the occurrence of each word. This is a classic example used in +the other SDK's and shows off many of the functionalities of Beam YAML. + +## Transforms + +Examples in this directory show off the various built-in transforms of the Beam +YAML framework. + +### Element-wise +These examples leverage the built-in mapping transforms including `MapToFields`, +`Filter` and `Explode`. More information can be found about mapping transforms +[here](../docs/yaml_mapping.md). + +### Aggregation +These examples leverage the built-in `Combine` transform for performing simple +aggregations including sum, mean, count, etc. + +These examples are experimental and require that +`yaml_experimental_features: Combine` be specified under the `options` tag, or +by passing `--yaml_experimental_features=Combine` to the command to run the +pipeline. i.e. +``` +python -m apache_beam.yaml.main \ + --pipeline_spec_file=/path/to/example.yaml \ + --yaml_experimental_features=Combine +``` +More information can be found about aggregation transforms +[here](../docs/yaml_combine.md). Review Comment: https://beam.apache.org/documentation/sdks/yaml-combine/ -- 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]
