kamilwu commented on a change in pull request #13048:
URL: https://github.com/apache/beam/pull/13048#discussion_r514395054
##########
File path: sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
##########
@@ -411,6 +411,33 @@ def visit_transform(self, transform_node):
return FlattenInputVisitor()
+ @staticmethod
+ def combinefn_visitor():
+ # Imported here to avoid circular dependencies.
+ from apache_beam.pipeline import PipelineVisitor
+ from apache_beam import core
+
+ class CombineFnVisitor(PipelineVisitor):
+ """Checks if `CombineFn` has non-default setup or teardown methods.
+ If yes, raises `ValueError`.
+ """
+ def visit_transform(self, applied_transform):
+ transform = applied_transform.transform
+ if isinstance(transform, core.ParDo) and isinstance(
+ transform.fn, core.CombineValuesDoFn):
+ if self._overrides_setup_or_teardown(transform.fn.combinefn):
+ raise ValueError(
+ 'CombineFn.setup and CombineFn.teardown are '
+ 'not supported with non-portable Dataflow '
+ 'runner. Please use Dataflow Runner V2 instead.')
Review comment:
I think the question is for Dataflow team. From my perspective, I think
there's no such need to support this in non-portable Dataflow, given that new
batch pipelines will start using Dataflow Runner V2 in a month (December 4).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]