apache / apache/beam

Visit composite transform nodes in Pipeline._check_replacement()

Open
#20,556 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

Pipeline.replace_all() calls _replace(), which replaces transform nodes using a PipelineVisitor, and then _check_replacement(), which validates that there are no replaceable transform nodes using a PipelineVisitor i.e. it checks that PTransformOverride.matches() does not return True on any nodes.

Currently, _replace() visits [both composite and leaf transform nodes](https://github.com/apache/beam/blob/b7ae7bb1dc28a7c8f26e9f48682e781a74e2d3c4/sdks/python/apache_beam/pipeline.py#L376-L382) whereas _check_replacement() visits [only leaf transform nodes](https://github.com/apache/beam/blob/b7ae7bb1dc28a7c8f26e9f48682e781a74e2d3c4/sdks/python/apache_beam/pipeline.py#L463-L468). _check_replacement() should visit composite transform nodes as well for symmetry.

Imported from Jira [BEAM-11024](https://issues.apache.org/jira/browse/BEAM-11024). Original Jira may contain additional context.
Reported by: myffical@gmail.com.

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.