hjtran opened a new pull request, #41921: URL: https://github.com/apache/beam/pull/41921
Fixes #36775 ## What was happening Composites like `Latest.PerKey` declare `@with_input_types(Tuple[K, V])` and use `K` in an inner transform's `.with_output_types(...)`. The inner transform has no input hint of its own, so nothing binds `K` and it falls back to `Any`. Every coder chosen from that point on is picked for `Any`, so a key type with a registered coder ends up pickled instead. Example with a `UserId` key and a registered deterministic `UserIdCoder`: | Step in `Latest.PerKey` | Before | After | |---|---|---| | input | `Tuple[UserId, int]` | `Tuple[UserId, int]` | | inner `ParDo` → `Tuple[K, ...]` | `Tuple[Any, ...]` | `Tuple[UserId, ...]` | | `CombinePerKey` | `Tuple[Any, Any]` | `Tuple[UserId, Any]` | | `GroupByKey` key coder | `FastPrimitivesCoder` + "Using fallback deterministic coder" warning | `UserIdCoder` | ## What changed - `Pipeline.apply` keeps a stack of type variable bindings. Entering a transform matches its declared input hint against the actual input type and pushes the result on top of the parent's bindings. - Output inference resolves any type variable it can't bind itself from that stack before falling back to `Any`. A child's own bindings take precedence, and bindings don't leak outside the composite. - Because this can change coders, it's gated: with `--update_compatibility_version` earlier than 2.79.0 the previous behavior is kept. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
