apache / apache/beam

Python SDK ignores manually set PCollection tags

Open
#20,065 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

The Python SDK currently ignores any tags set on PCollections manually when applying PTransforms when adding the PCollection to the PTransform [outputs]([https://github.com/apache/beam/blob/688a4ea53f315ec2aa2d37602fd78496fca8bb4f/sdks/python/apache_beam/pipeline.py#L595)]. In the [add_output]([https://github.com/apache/beam/blob/688a4ea53f315ec2aa2d37602fd78496fca8bb4f/sdks/python/apache_beam/pipeline.py#L872)] method, the tag is set to None for all PValues, meaning the output tags are set to an enumeration index over the PCollection outputs. The tags are not propagated to correctly which can be a problem on relying on the output PCollection tags to match the user set values.

The fix is to correct BEAM-1833, and always pass in the tags. However, that doesn't fix the problem for nested PCollections. If you have a dict of lists of PCollections, what should their tags be correctly set to? In order to fix this, first propagate the correct tag then talk with the community about the best auto-generated tags.

Some users may rely on the old implementation, so a flag will be created: "force_generated_pcollection_output_ids" and be default set to False. If True, this will go to the old implementation and generate tags for PCollections.

Imported from Jira [BEAM-9322](https://issues.apache.org/jira/browse/BEAM-9322). Original Jira may contain additional context.
Reported by: rohdesam.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.