Pratik1326 commented on issue #36775: URL: https://github.com/apache/beam/issues/36775#issuecomment-7353610653
I audited `transforms/` and `typehints/` locally for where `PerKey` / composite transforms lose inferred types on a `Tuple[str, int]` input: - **`Latest.PerKey` (`transforms/combiners.py`):** Its inner `ParDo(self.add_timestamp)` lacks `.with_input_types(...)` and uses `T` rather than `V`, causing `Tuple[Any, Any]` on output. - **`ApproximateUnique.PerKey` & `ApproximateQuantiles.PerKey` (`transforms/stats.py`):** Their underlying `CombineFn`s don't declare type hints, so `CombinePerKey` infers `Tuple[str, Any]` (`!= Any`), which causes `_infer_result_type` to skip the outer `PerKey` output type hint. Rather than changing global composite propagation in `pipeline.py` (which would conflict with existing type-scoping assertions in `ptransform_test.py`), I'm starting with a focused fix on these `PerKey` transforms plus unit tests in `combiners_test.py` and `stats_test.py`. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
