From 0bf6f69c8bb1670795d86cd3fdfa5b2a402f963e Mon Sep 17 00:00:00 2001 From: Jeff Kinard Date: Fri, 6 Dec 2024 15:49:47 -0500 Subject: [PATCH] [yaml] various inline provider doc fixes (#33296) * [yaml] various inline provider doc fixes Signed-off-by: Jeffrey Kinard * Update yaml_combine.py --------- Signed-off-by: Jeffrey Kinard Co-authored-by: Robert Bradshaw --- sdks/python/apache_beam/yaml/yaml_combine.py | 6 ++++ sdks/python/apache_beam/yaml/yaml_mapping.py | 29 +++++++++++--------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/sdks/python/apache_beam/yaml/yaml_combine.py b/sdks/python/apache_beam/yaml/yaml_combine.py index a28bef52ea31..b7499f3b0c7a 100644 --- a/sdks/python/apache_beam/yaml/yaml_combine.py +++ b/sdks/python/apache_beam/yaml/yaml_combine.py @@ -94,6 +94,12 @@ class PyJsYamlCombine(beam.PTransform): See also the documentation on [YAML Aggregation](https://beam.apache.org/documentation/sdks/yaml-combine/). + + Args: + group_by: The field(s) to aggregate on. + combine: The aggregation function to use. + language: The language used to define (and execute) the + custom callables in `combine`. Defaults to generic. """ def __init__( self, diff --git a/sdks/python/apache_beam/yaml/yaml_mapping.py b/sdks/python/apache_beam/yaml/yaml_mapping.py index 9f92f59f42b6..8f4a2118c236 100644 --- a/sdks/python/apache_beam/yaml/yaml_mapping.py +++ b/sdks/python/apache_beam/yaml/yaml_mapping.py @@ -428,19 +428,19 @@ class _StripErrorMetadata(beam.PTransform): For example, in the following pipeline snippet:: - - name: MyMappingTransform - type: MapToFields - input: SomeInput - config: - language: python - fields: - ... - error_handling: - output: errors - - - name: RecoverOriginalElements - type: StripErrorMetadata - input: MyMappingTransform.errors + - name: MyMappingTransform + type: MapToFields + input: SomeInput + config: + language: python + fields: + ... + error_handling: + output: errors + + - name: RecoverOriginalElements + type: StripErrorMetadata + input: MyMappingTransform.errors the output of `RecoverOriginalElements` will contain exactly those elements from SomeInput that failed to processes (whereas `MyMappingTransform.errors` @@ -453,6 +453,9 @@ class _StripErrorMetadata(beam.PTransform): _ERROR_FIELD_NAMES = ('failed_row', 'element', 'record') + def __init__(self): + super().__init__(label=None) + def expand(self, pcoll): try: existing_fields = {