[FLINK-40541][table-planner] Detect build-side watermark hidden by column expansion in LATERAL SNAPSHOT - #29081
Closed
fhueske wants to merge 1 commit into
Conversation
…lumn expansion in LATERAL SNAPSHOT LATERAL SNAPSHOT detected the build-side watermark by looking for a row-time indicator field in the projected TABLE argument. When the watermark sits on a column that the column-expansion strategy hides from SELECT * (e.g. a virtual metadata column under EXCLUDE_DEFAULT_VIRTUAL_METADATA_COLUMNS), TABLE t expands to a projection that drops the row-time attribute, so the rule found none and wrongly rejected the query with "LATERAL SNAPSHOT requires a watermark on the build-side input". Recover the row-time attribute from below the hiding projection and re-append it so it reaches the operator: from a WatermarkAssigner, or, when the watermark was pushed into the source, by re-stamping the scan's row-time column (resolved by name from the watermark spec) as a row-time indicator. The top-level Calc projects the re-appended column away, so the output is unchanged. Co-Generated: Claude Opus 4.8 (1M context)
Collaborator
snuyanzin
reviewed
Sep 3, 2026
| + "load_completed_time => CAST(TIMESTAMP '2026-07-01 00:00:00' AS TIMESTAMP_LTZ(3))" | ||
| + ") AS s ON probe.pk = s.bk"; | ||
| final String plan = util.tableEnv().explainSql(sql); | ||
| assertThat(plan).contains("LateralSnapshotJoin"); |
Contributor
There was a problem hiding this comment.
how about verifying the whole plan instead?
e.g. util.verifyRelPlan
Contributor
Author
|
Closing this PR, opening one with a different approach |
fhueske
deleted the
fhueske-FLINK-40541-Detect-build-side-watermark-on-hidden-metadata-column
branch
September 3, 2026 20:33
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.
What is the purpose of the change
LATERAL SNAPSHOT detected the build-side watermark by looking for a row-time indicator field in the projected TABLE argument. When the watermark sits on a column that the column-expansion strategy hides from SELECT * (e.g. a virtual metadata column under EXCLUDE_DEFAULT_VIRTUAL_METADATA_COLUMNS), TABLE t expands to a projection that drops the row-time attribute, so the rule found none and wrongly rejected the query with "LATERAL SNAPSHOT requires a watermark on the build-side input".
Recover the row-time attribute from below the hiding projection and re-append it so it reaches the operator: from a WatermarkAssigner, or, when the watermark was pushed into the source, by re-stamping the scan's row-time column (resolved by name from the watermark spec) as a row-time indicator. The top-level Calc projects the re-appended column away, so the output is unchanged.
Brief change log
Verifying this change
Run new and existing tests for LateralSnapshotJoin
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 Opus 4.8 (1M context)