-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fixed the bug that caused incompatible behavior when comparing int64 or int32 column with double literals in query filter conditions #16917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
alpass163
commented
Dec 17, 2025
- Supported DoubleLiteral and LongLiteral comparisons for INT32 and INT64 columns. Implemented precise rounding logic (ceil/floor) for doubles and handled overflow scenarios
- introduce tsfile version: 2.2.0-251216-SNAPSHOT, update interfaces provided by tsfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes a bug in the query filter predicate conversion logic that caused incompatible behavior when comparing INT32 or INT64 columns with double literals. The fix implements proper rounding logic (ceil/floor) for double values and handles overflow scenarios where doubles exceed integer type bounds. Additionally, the PR updates the TSFile dependency to version 2.2.0-251216-SNAPSHOT to accommodate new API interfaces.
Key changes include:
- Implementation of double-to-integer conversion logic with appropriate rounding semantics for comparison operators
- Overflow detection for doubles exceeding INT32/INT64 ranges, returning appropriate filters (FalseLiteralFilter or ValueIsNotNullOperator)
- Support for INT64 literal comparisons with INT32 columns through type promotion
- TSFile API updates to accommodate new method signatures requiring additional parameters or throwing IOException
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Updates TSFile version from 2.2.0-251113-SNAPSHOT to 2.2.0-251216-SNAPSHOT |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java | Implements double literal conversion logic for table model predicates with overflow handling |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/predicate/ConvertPredicateToFilterVisitor.java | Implements double literal conversion logic for tree model predicates with overflow handling using BigDecimal |
| iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java | Removes unnecessary TSEncoding.valueOf wrapper due to TSFile API change |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/repair/RepairDataFileScanUtil.java | Adds null parameter to getDeviceTimeseriesMetadata call for TSFile API compatibility |
| iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java | Adds IOException declarations and null parameter for TSFile API compatibility |
| iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/predicate/TablePredicateConversionTest.java | Comprehensive unit tests for table model double literal conversion covering positive/negative values, overflow, and all comparison operators |
| iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/expression/predicate/TreePredicateConversionTest.java | Comprehensive unit tests for tree model double literal conversion with parallel coverage to table model |
| integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBPredicateConversionTableIT.java | End-to-end integration tests validating query behavior with double literals for table model |
| integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBPredicateConversionTreeIT.java | End-to-end integration tests validating query behavior with double literals for tree model |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java
Show resolved
Hide resolved
...iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java
Show resolved
Hide resolved
.../iotdb/db/queryengine/plan/expression/visitor/predicate/ConvertPredicateToFilterVisitor.java
Show resolved
Hide resolved
...iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java
Show resolved
Hide resolved
| // when literal is the doubleLiteral type, the columnDataType INT64 or INT32 has to be | ||
| // converted. |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is slightly misleading. It states that "columnDataType INT64 or INT32 has to be converted" when actually it's the double literal that gets converted (rounded) to match the integer column type. Consider rephrasing to: "when literal is DoubleLiteral and column is INT64 or INT32, convert the double literal to an appropriate integer value".
…or int32 column with double literals in query filter conditions. introduce tsfile version: 2.2.0-251216-SNAPSHOT, update interfaces provided by tsfile
7f6fa63 to
3d4bc23
Compare