Abhi2939 commented on issue #41350:
URL: https://github.com/apache/beam/issues/41350#issuecomment-6896634892

   Hi @jk-shah, I'd like to work on this one.
   
   I confirmed that `out.element_type` shows `typing.Any` for `count` and 
`mean` with the reproducer. My plan is to fix it in `yaml_combine.py`: before 
`extract_return_type` falls back to `Any`, it would ask the CombineFn instance 
for its output type (via `get_type_hints` / `get_output_type`) and use that 
when it's concrete.
   
   An alternative is to annotate the builtin CombineFns in `combiners.py` with 
`@with_output_types`. That would be a cleaner long-term fix, but it changes 
type checking for all Python users of those classes, so I'd keep this PR scoped 
to the YAML side and only do that as a follow-up if maintainers want it.
   
   For tests, I'll assert the inferred `element_type` for `count`, `mean`, 
`group` and `concat`, and add an end-to-end pipeline into `WriteToParquet` that 
fails without the fix.
   
   Does the scoped approach sound right, or would you rather I annotate the 
CombineFns directly?


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

Reply via email to