[FLINK-25802][FLINK-30499][table-planner] Fix TIMESTAMP codegen for RANGE OVER window bounds - #28858
Open
Izeren wants to merge 1 commit into
Open
Conversation
…ANGE OVER 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 millis via .getMillisecond(), and promote child member code to the parent context via addReusableMember(). Generated-by: Claude Code
Izeren
force-pushed
the
fix/FLINK-25802-timestamp-range-over-codegen
branch
from
August 3, 2026 12:31
d9de951 to
4933b95
Compare
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
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?