weiqingy opened a new pull request, #29908:
URL: https://github.com/apache/flink/pull/29908
## What is the purpose of the change
`EARLY_FIRE` is a streaming interval-join hint, but it is registered as a
`JoinStrategy`. In batch mode the join rules passed it to
`BatchPhysicalJoinRuleBase#checkJoinStrategyValid`, which has no case for it,
so every batch query with the hint failed at planning with `Unknown join
strategy : EARLY_FIRE`, inner joins included. This pull request makes batch
mode ignore the hint, so such a query plans exactly as it would without the
hint.
## Brief change log
- `BatchPhysicalJoinRuleBase#checkJoinStrategyValid` returns `(false,
false)` for `EARLY_FIRE`, as it already does for `LOOKUP`, so the batch rules
skip the hint and choose the join as if no hint were given.
- `JoinUtil#containsJoinStrategyHint` no longer counts `EARLY_FIRE`.
Otherwise the batch hash join and sort-merge join rules mark the join as
hinted, which keeps it from becoming an adaptive join, so the ignored hint
would still change the plan under the default configuration. A real strategy
hint next to `EARLY_FIRE` still marks the join as hinted.
- The SQL join docs (English and Chinese) state that the hint is ignored
in batch mode.
## Verifying this change
This change added tests and can be verified as follows:
- Added `plan/hints/batch/EarlyFireJoinHintTest`. For a LEFT and an INNER
interval join, it plans the query with and without the hint, with adaptive
broadcast join enabled as in the default configuration. It checks that the plan
without the hint contains an `AdaptiveJoin`, then that the optimized physical
and execution plans with the hint are identical to it.
- `EarlyFireJoinHintTest#testStrategyHintStillAppliesWithEarlyFire` checks
that `EARLY_FIRE` next to `SHUFFLE_MERGE(o)` plans exactly like
`SHUFFLE_MERGE(o)` alone, with no `AdaptiveJoin`, so the user's strategy hint
is still honored.
- Without the `checkJoinStrategyValid` change the tests fail with `Unknown
join strategy : EARLY_FIRE`. Without the `containsJoinStrategyHint` change the
two hint-only tests fail because the hinted plan is a plain `HashJoin` instead
of the `AdaptiveJoin`.
- The existing batch join hint tests, the streaming
`EarlyFireJoinHintTest`, `AdaptiveJoinTest` and `AdaptiveJoinBatchRestoreTest`
still pass.
## 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? docs
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code 2.1.322 (Claude Opus 5.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]