[FLINK-40170][table-planner] Infer update-producing changelog mode for early-fire interval join - #28877
Draft
weiqingy wants to merge 2 commits into
Draft
[FLINK-40170][table-planner] Infer update-producing changelog mode for early-fire interval join#28877weiqingy wants to merge 2 commits into
weiqingy wants to merge 2 commits into
Conversation
Add an optional `target` option to the EARLY_FIRE join hint. Only `interval_join` is accepted today; any other value fails planning. An omitted target is equivalent to `interval_join`, so existing hints keep their meaning. `target` scopes the hint to a single operator kind. The interval-join rule consumes the hint only when it targets the interval join and leaves a hint aimed at another operator kind untouched, so an untargeted hint never silently expands its scope.
…fire interval join With the EARLY_FIRE hint, an outer interval join speculatively emits a padded unmatched row after the delay and corrects it when a match later arrives, so it no longer produces insert-only changes. Teach FlinkChangelogModeInferenceProgram to reflect this. Split StreamPhysicalIntervalJoin into its own ModifyKindSet arm: its children still consume insert-only, but the node provides INSERT and, when the hint makes it update-producing, UPDATE. A new produceEarlyFireUpdates accessor gates that on the hint being set, the join being outer, and a non-negative window span, so the hint stays inert for inner joins and negative-window joins (which only ever emit inserts). The interval join keeps its place in the UpdateKind and DeleteKind arms. When such a join feeds an insert-only downstream, planning fails with a tailored error that names the hint, rather than the generic "doesn't support consuming update changes" message. Runtime behavior is unchanged; the operator still ignores the hint. The compiled-plan round-trip test's sink now declares sink-insert-only=false: its early-fire outer join produces updates under the new inference, so the previously insert-only sink no longer accepts the pipeline.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the FLIP-497 implementation stack under umbrella FLINK-36953. Landing order:
targetoption (#28827, in review)Opened as a draft because it is stacked on #28827, which is still in review. Until that merges, the commit list and diff here also carry PR-2's commit. Once #28827 merges I will rebase onto master, leaving only this PR's change, and take it out of draft.
What is the purpose of the change
With the
EARLY_FIREhint, an outer interval join emits a speculative null-padded row after the delay and corrects it when a match later arrives, so its result is no longer insert-only. This makes the planner infer that update-producing changelog mode, and reject an insert-only downstream with an error that names the hint instead of the generic "doesn't support consuming update changes" message. Inner joins and negative-window joins only ever emit inserts, so the hint stays inert for them and they remain append-only.Runtime behavior is unchanged. The operator still ignores the hint; emission lands in PR-4.
Brief change log
FlinkChangelogModeInferenceProgramgets its ownModifyKindSetarm forStreamPhysicalIntervalJoin: children still consume insert-only, but the node providesINSERTand, when the hint makes it update-producing,UPDATE. It keeps its place in theUpdateKindandDeleteKindarms.StreamPhysicalIntervalJoin.produceEarlyFireUpdatesgates that on three conditions: the hint is set, the join is outer, and the window span is non-negative.TableExceptionwhen such a join feeds an insert-only downstream.sink-insert-only=false. Its early-fire outer join produces updates under the new inference, so the previously insert-only sink no longer accepts that pipeline. This is the one existing behavior this PR changes.Verifying this change
This change added tests and can be verified as follows:
EarlyFireJoinHintTest: an early-fire outer join is inferred aschangelogMode=[I,UA]; an insert-only downstream fails with the tailored error; a negative-window join and an inner join both stay[I]while still carryingearlyFireDelayon the join node, so the hint is attached but inert rather than absent.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Anthropic)