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 18:02:10 UTC

[GitHub] [beam] damccorm opened a new issue, #20513: Support type hint annotations on CombineFn add_input() and extract_output()

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

   Similar to the tweaks for supporting native type hints on the `PTransform.expand()` method (https://issues.apache.org/jira/browse/BEAM-10258), it would be beneficial if the `CombineFn` class also received similar treatment, offering a way to provide type hints through the native Python hinting interface.
   
   Adding hints to the CombineFn's `add_input()` and `extract_output()` methods should be sufficient for providing the equivalent behavior of annotating the class with beam typehint decorators, e.g.,
   ```
   
   @beam.typehints.with_input_types(int)
   @beam.typehints.with_output_types(bool)
   class MyCombineFn(CombineFn):
   
    ...
   
   ```
   
   vs
   ```
   
   class MyCombineFn(CombineFn):
     def add_input(self, accumulator: float, element: int):
       ...
   
   
    def extract_output(self, accumulator: float) -> bool
       ...
   
   ```
   
   
   Imported from Jira [BEAM-10418](https://issues.apache.org/jira/browse/BEAM-10418). Original Jira may contain additional context.
   Reported by: metzen.


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