SEPURI-SAI-KRISHNA opened a new pull request, #29281:
URL: https://github.com/apache/flink/pull/29281
## What is the purpose of the change
FLINK-40751 replaced `stream.keyBy(keySelector)` in
`StateBootstrapTransformation` with a `PartitionTransformation`, which also
removed the key type validation `KeyedStream` does.
`OneInputStateTransformation#keyBy` only extracts the key type, so an array
key, an enum key or a POJO without `hashCode` is no longer rejected: the
bootstrap job builds, runs and writes a savepoint. Such a key is not hashed
reliably, so two equal `byte[] {1, 2, 3}` keys can end up in different key
groups (48 and 39 in a local run at `maxParallelism` 128), and a job restoring
that savepoint would reject the key type in its own `keyBy`. Reported on #29268.
## Brief change log
- Move the key type validation out of `KeyedStream` into
`KeySelectorUtil#validateKeyType`, which both call. `KeyedStream` behaviour is
unchanged.
- Validate the key type in `StateBootstrapTransformation` where the
`PartitionTransformation` is built, so the error appears at the same point as
before FLINK-40751.
## Verifying this change
- `StateBootstrapTransformationTest` gets two cases: an array key is
rejected with `InvalidProgramException`, a `String` key still works. The first
fails without the fix.
- Checked through `SavepointWriter` that an array key, an enum key and a
POJO without `hashCode` are rejected again, as before FLINK-40751, and that a
`String` key is unaffected.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): **no**
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: **no**
- The serializers: **no**
- The runtime per-record code paths (performance sensitive): **no**
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: **no**
- The S3 file system connector: **no**
## Documentation
- Does this pull request introduce a new feature? **no**
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Opus 5)
--
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]