Repository navigation
Conversation
Accept GenericLiteral timestamp bounds when converting table-model time predicates, and cover comparison and IN filters with integration tests.
Recognize timestamp GenericLiteral bounds in comparison and BETWEEN predicates, and verify the extracted time predicate through EXPLAIN in integration tests.
Evaluate constant timestamp expressions when inferring gap-fill ranges, including CAST bounds, and cover comparison and BETWEEN forms in integration tests.
JackieTien97
approved these changes
Nov 11, 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.
Summary
GenericLiteraltimestamp bounds when converting table-model time filters.DeviceTableScanNoderetains itsTimePredicateand partition pruning remains effective.CAST(... AS TIMESTAMP)expressions before gap-fill range inference, including comparison andBETWEENbounds.IN,BETWEEN, EXPLAIN time-predicate extraction, and gap-fill range inference.Reproduction Data
Problems And Fixes
1. Time filters using
CAST(... AS TIMESTAMP)Constant folding represents
CAST(2 AS TIMESTAMP)as a timestampGenericLiteral, butConvertPredicateToTimeFilterVisitoronly acceptedLongLiteral. The CAST bound could therefore reach the visitor as aGenericLiteraland fail withGenericLiteral cannot be cast to LongLiteral.The same problem affected multi-value and single-value
INpredicates:After the fix, timestamp
GenericLiteralvalues are converted through the same long-value path asLongLiteral. The range query returns records at times 2, 3, and 4; the multi-valueINquery returns records at times 2 and 4; and the single-valueINquery returns the record at time 2.2. Missing time predicates for partition pruning
GlobalTimePredicateExtractVisitorpreviously recognized onlyLongLiteraltimestamp bounds. Consequently,GenericLiteralbounds produced by timestamp CAST constant folding were not extracted as global time predicates. The table scan then had noTimePredicate, so partition pruning could be omitted and the query could schedule unnecessary partitions.The same omission affected comparison and
BETWEENpredicates. After the fix, the generated plan containsDeviceTableScanNode.properties.TimePredicatefor comparison,BETWEEN, and single-valueINforms.3. Gap-fill queries using CAST timestamp boundaries
GapFillStartAndEndTimeExtractVisitorpreviously accepted onlyLongLiteralboundaries. A constantCAST(... AS TIMESTAMP)could not be used to infer the range, so the query failed with:The visitor now evaluates symbol-free constant expressions before range inference and only falls back to an empty range when the expression is non-constant. Internal conversion errors are not broadly suppressed: symbol-containing expressions are checked first, and only
VerifyExceptionfrom non-constant verification is handled.The same handling is applied to
BETWEEN. The integration test uses< endTimeandBETWEEN startTime AND endTime - 1so both queries cover the same half-open time range.Validation
mvn spotless:apply -pl iotdb-core/datanodemvn spotless:apply -f integration-test/pom.xmlgit diff --check