fresh-borzoni opened a new pull request, #27372: URL: https://github.com/apache/flink/pull/27372
## What is the purpose of the change closes https://issues.apache.org/jira/browse/FLINK-38753 Enriches upsert keys using equi-join column equivalences to avoid unnecessary `upsertMaterialize` in streaming sinks. Consider: `src1` pk `{a1}`, `src2` pk `{a2, b2}`, join on `a1 = a2`, sink pk `{a1, b2}`. Currently the join produces upsert keys `{a2, b2}` and `{a1, a2, b2}` - neither contains `{a1, b2}`, so Flink adds `upsertMaterialize`. But since `a1 = a2` in the join, `{a1, b2}` is semantically equivalent to `{a2, b2}`. This PR makes the planner recognize that equivalence. ## Brief change log - Added `enrichJoinedKeys` to substitute columns via `JoinInfo` equivalences - Added `enrichMultiJoinKeys` for `MultiJoin` equivalences - Added shared `enrichKeysWithEquivalences` core logic - Applied enrichment in `getUpsertKeys` for both `Join` and `MultiJoin` ## Verifying this change New tests added: - `testJoinUpsertKeyEnrichmentInnerJoinBasic` - basic case from FLINK-38753 - `testJoinUpsertKeyEnrichmentInnerJoinReverse` - enrichment in opposite direction - `testJoinUpsertKeyEnrichmentLeftJoin` - left outer join - `testJoinUpsertKeyEnrichmentRightJoin` - right outer join - `testJoinUpsertKeyEnrichmentMultipleEquiConditions` - multiple equi-join columns - `testJoinUpsertKeyEnrichmentNegativeCase` - confirms `upsertMaterialize` when sink pk uses non-join column - `testUpsertKeyEnrichmentThreeWayJoin` - multi-way join via `MultiJoin` ## 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 - If yes, how is the feature documented? not applicable -- 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]
