Skip to content

Properly propagate schemas of Beam YAML Partition transform. #34595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdks/python/apache_beam/yaml/yaml_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,9 @@ def split(element):
mapping_transform = mapping_transform.with_outputs(*output_set)
splits = pcoll | mapping_transform.with_input_types(T).with_output_types(T)
result = {out: getattr(splits, out) for out in output_set}
for tag, out in result.items():
if tag != error_output:
out.element_type = pcoll.element_type
if error_output:
result[error_output] = result[error_output] | map_errors_to_standard_format(
pcoll.element_type)
Expand Down
1 change: 1 addition & 0 deletions sdks/python/apache_beam/yaml/yaml_mapping_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def test_partition(self):
language: python
outputs: [even, odd]
''')
self.assertEqual(result['even'].element_type, elements.element_type)
assert_that(
result['even'] | beam.Map(lambda x: x.element),
equal_to(['banana', 'orange']),
Expand Down
Loading