[CALCITE-7529] RexExecutor constant reduction loses sub-millisecond precision for TIME/TIMESTAMP literals#4942
Open
zzwqqq wants to merge 1 commit into
Open
[CALCITE-7529] RexExecutor constant reduction loses sub-millisecond precision for TIME/TIMESTAMP literals#4942zzwqqq wants to merge 1 commit into
zzwqqq wants to merge 1 commit into
Conversation
…recision for TIME/TIMESTAMP literals
|
mihaibudiu
reviewed
May 15, 2026
| @Override public void reduce(RexBuilder rexBuilder, List<RexNode> constExps, | ||
| List<RexNode> reducedValues) { | ||
| assert reducedValues.isEmpty(); | ||
| final List<RexNode> exps = new ArrayList<>(); |
Contributor
There was a problem hiding this comment.
what happens here? you are only reducing expressions which are already literals?
This seems to be some kind of regression - other constant expressions are not reduced?
Contributor
Author
There was a problem hiding this comment.
I'm copying literals through unchanged, and compiling/reducing only non-literal constant expressions.
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.



Jira Link
CALCITE-7529
Changes Proposed
Fix constant reduction of high-precision
TIMEandTIMESTAMPliterals.RexExecutorImplevaluates constants using generated Java code, whereTIMEandTIMESTAMPuse millisecond-based runtime values. This can drop digits beyond milliseconds when a customRelDataTypeSystemallows precision greater than 3.This PR avoids that loss by keeping high-precision temporal literal casts as Rex literals when possible, and by leaving existing
RexLiterals unchanged during reduction.Added regression tests for
TIME(6),TIMESTAMP(6), existing temporal literals, andTIME(6)toVARCHAR.