tvalentyn commented on pull request #13081: URL: https://github.com/apache/beam/pull/13081#issuecomment-707893036
> Note that one can always override CombineFn.apply(), so this seems more about setup/teardown, right? Yes, setup/teardown was primary motivation for writing this up. > The disadvantage of a special method means that the semantics are unclear of whether one is allowed to call apply() with an empty iterable... or is one forced to check if the iterable is empty to choose to call apply or default_value? I'm thinking about other places CombineFns may be used used, for example, in CombiningStates. I can clarify in the api that this is optional, and defaults to empty apply() call if we decide to proceed as is. > If the goal is just to avoid calling setup/teardown in the main program In your opinion, is calling setup/teardown in main program a concern at all? Perhaps I am overthinking this. > we can rewrite the InjectDefault inside CombineGlobally to take an iterable side input and invoke apply([]) manually (with the setup and teardown) iff the iterable is empty. So in this case evaluation of the default will happen after job submission? I admit I don't fully follow the idea, so if writing a prototype of this idea is faster than explaining how to do it right to myself of Kamil, we'd appreciate a draft; thanks! ---------------------------------------------------------------- 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]
