[FLINK-25802][FLINK-30499][table-planner] Fix TIMESTAMP codegen for RANGE OVER window bounds - #28971
Open
Izeren wants to merge 1 commit into
Open
[FLINK-25802][FLINK-30499][table-planner] Fix TIMESTAMP codegen for RANGE OVER window bounds#28971Izeren wants to merge 1 commit into
Izeren wants to merge 1 commit into
Conversation
Collaborator
Izeren
force-pushed
the
backport-28858-1.20
branch
2 times, most recently
from
August 13, 2026 14:47
5c729e0 to
c638ac8
Compare
Izeren
force-pushed
the
backport-28858-1.20
branch
from
August 14, 2026 10:46
c638ac8 to
18c43ad
Compare
…ER` window bounds Generated-by: Claude Code
Izeren
force-pushed
the
backport-28858-1.20
branch
from
August 14, 2026 15:52
18c43ad to
3866794
Compare
Izeren
marked this pull request as ready for review
August 17, 2026 08:05
Contributor
Author
|
@snuyanzin, I have used old style tests for this cherry-pick to avoid resolving conflicts with batch tests. Could you please have a look when you have time? |
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.
Cherry-pick of #28858 to release-1.20.
What is the purpose of the change
RangeBoundComparatorCodeGeneratorproduces Janino compile errors forRANGE OVERwindows withTIMESTAMPORDER BY columns. Two separate bugs:(FLINK-25802)
TIMESTAMPcolumns are bound asBigIntTypebut the rawTimestampDataterm is passed directly toExprCodeGenerator.bindInput(), causing an invalid(Long) timestampDatacast at runtime.(FLINK-30499)
TIMESTAMP_WITH_LOCAL_TIME_ZONEfalls through thecase _default with no special handling, andctx.reuseMemberCode()is emitted inside thecompare()method body instead of at class scope, causing a Janino compile error for any type that triggers member code generation.Both bugs surface as:
Brief change log
TIMESTAMP_WITHOUT_TIME_ZONEandTIMESTAMP_WITH_LOCAL_TIME_ZONEthat scales the Calcite millisecond bound to microseconds and derives epoch-microsecond values viagetMillisecond() * 1000L + getNanoOfMillisecond() / 1000, preserving sub-millisecond precision without risking Long overflowCodeGeneratorContextmember code to the parent context viaaddReusableMember(), placing class-level declarations at class scope rather than insidecompare()batch/sql/OverAggregateITCaseforTIMESTAMP(6)andTIMESTAMP_LTZ(6)ORDER BY columns with a sub-millisecond boundary rowVerifying this change
This change added tests and can be verified as follows:
testRangeOverWithTimestampandtestRangeOverWithTimestampLtztoOverAggregateITCase(old-styleBatchTestBaseIT tests, consistent with release-1.20 conventions). Both tests include a sub-millisecond row to verify microsecond-precision window boundary exclusion.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?