Skip to content

[FLINK-41446][table-planner] Ignore the EARLY_FIRE join hint in batch mode - #29908

Open
weiqingy wants to merge 1 commit into
apache:masterfrom
weiqingy:FLINK-41446-batch-early-fire
Open

weiqingy wants to merge 1 commit into
apache:masterfrom
weiqingy:FLINK-41446-batch-early-fire

Conversation

@weiqingy

Copy link
Copy Markdown
Contributor

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?
  • Yes (please specify the tool below)

Generated-by: Claude Code 2.1.322 (Claude Opus 5.5)

… mode

EARLY_FIRE is a streaming interval-join hint, but it is registered as a
JoinStrategy, so the batch join rules passed it to checkJoinStrategyValid.
That method has no case for it and threw "Unknown join strategy :
EARLY_FIRE" for every batch query with the hint, inner joins included.

Skip the hint there, as is already done for LOOKUP, so the batch planner
chooses the join as if no hint were given. Also stop
containsJoinStrategyHint from counting it: a join marked as hinted is never
turned into an adaptive join, so the ignored hint would otherwise still
change the batch plan under the default configuration.
@flinkbot

flinkbot commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants