You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/04 14:26:51 UTC

[GitHub] [beam] damccorm opened a new issue, #19913: Typehint for Python CombineFn Accumulator

damccorm opened a new issue, #19913:
URL: https://github.com/apache/beam/issues/19913

   Feature request:
   Allow users to specify a typehint for the accumulator type of CombineFn, either through a typehints decorator, or by using Python type annotations on the CombineFn methods, or through inheriting a CombineFn [generic type](https://docs.python.org/3/library/typing.html#user-defined-generic-types).
   
   Benefits:
    * Allow the user to [specify a more efficient coder](https://beam.apache.org/documentation/programming-guide/#data-encoding-and-type-safety) for accumulators if one is available. Currently users are able to do this for the input and output elements, but not the accumulators, which [always uses the fallback coder](https://github.com/apache/beam/blob/d664592ee761d45b0273edb027a18c6ed9340349/sdks/python/apache_beam/transforms/core.py#L859-L860).
    * Allows typechecking of methods for CombineFn e.g. check that create_accumulator(), add_input() and merge_accumulators() returns accumulators. This provides better developer ergonomics as the CombineFnAPI is non-trivial.
   
   Imported from Jira [BEAM-8519](https://issues.apache.org/jira/browse/BEAM-8519). Original Jira may contain additional context.
   Reported by: myffical@gmail.com.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org