Eliaaazzz opened a new pull request, #39547:
URL: https://github.com/apache/beam/pull/39547
`coders.registry.get_coder` receives `typing` and native generic annotations
unconverted: `typing.Tuple[str, float]` and `tuple[str, float]` both fall back
to `FastPrimitivesCoder` (pickling) instead of a real `TupleCoder`. `Watch`
infers its output coder and its dedup-key coder from return annotations, so an
annotated poll function or key function silently got a pickling coder and the
`(input, output)` element type degraded to `Any`.
`Watch` now converts the hint with
`native_type_compatibility.convert_to_beam_type` before the registry lookup, at
both inference sites. A poll function annotated `-> PollResult[tuple[str,
float]]` yields a real tuple coder and a fully typed element type; the same
applies to `output_key_fn` return annotations, which #39461 relies on for
`MatchContinuously`'s `(path, mtime)` dedup keys.
Split out of #39461 per review so the inference fix can land on its own.
Tests: a new `watch_test` case covers the native and `typing.Tuple`
annotation forms end to end through `expand`. 28 watch tests pass; yapf and
ruff clean.
------------------------
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [ ] [**Choose
reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and
mention them in a comment (`R: @username`).
- [ ] Mention the appropriate issue in your description (for example:
`addresses #123`), if applicable. This will automatically add a link to the
pull request in the issue. If you would like the issue to automatically close
on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://cla.apache.org/).
See the [Contributor Guide](https://beam.apache.org/contribute) for more
tips on [how to make review process
smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit
[https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
--
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]