[FLINK-25802][FLINK-30499][table-planner] Fix TIMESTAMP codegen for RANGE OVER window bounds - #28967
Merged
Merged
Conversation
Collaborator
Izeren
marked this pull request as ready for review
August 13, 2026 09:52
Izeren
marked this pull request as draft
August 13, 2026 10:25
…ER` window bounds RangeBoundComparatorCodeGenerator bound TIMESTAMP columns as BigIntType but passed the raw TimestampData term to ExprCodeGenerator, causing an invalid (Long) cast at Janino compile time (FLINK-25802). TIMESTAMP_WITH_LOCAL_TIME_ZONE fell through to the default case, and reuseMemberCode() was emitted inside compare() instead of the class scope (FLINK-30499). Fix: use LogicalTypeFamily.TIMESTAMP to cover all three TIMESTAMP variants, extract epoch time with microseconds precision, and promote child member code to the parent context via addReusableMember(). Generated-by: Claude Code
Izeren
force-pushed
the
backport-28858-2.3
branch
from
August 13, 2026 10:36
e899647 to
8c612a2
Compare
Izeren
marked this pull request as ready for review
August 13, 2026 14:52
Contributor
Author
|
@snuyanzin, CI is green PTAL when you have time |
snuyanzin
approved these changes
Aug 14, 2026
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-2.3.
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
LogicalTypeRootmatch withLogicalTypeFamily.TIMESTAMP/LogicalTypeFamily.TIMEif/else to cover all three TIMESTAMP variants uniformly (and remain forward-compatible with future additions).getMillisecond()before passing the value toExprCodeGenerator.bindInput(), so the variable type matches the declaredBigIntTypeCodeGeneratorContextmember code to the parent context viaaddReusableMember(), placing class-level declarations at class scope rather than insidecompare()batch/sql/OverAggregateITCaseforTIMESTAMP(3)andTIMESTAMP_LTZ(3)ORDER BY columnsVerifying this change
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?