alpass163 commented on code in PR #16917:
URL: https://github.com/apache/iotdb/pull/16917#discussion_r2634105876
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/ConvertPredicateToFilterVisitor.java:
##########
@@ -155,9 +163,117 @@ public static <T extends Comparable<T>> Filter
constructCompareFilter(
int measurementIndex =
context.getMeasurementIndex(symbolReference.getName());
Type type = context.getType(Symbol.from(symbolReference));
+ TSDataType columnDataType = InternalTypeManager.getTSDataType(type);
+
+ // when literal is the doubleLiteral type and the columnDataType is INT64
or INT32,
+ // the doubleLiteral has to be converted.
+ if (literal instanceof DoubleLiteral) {
+ DoubleLiteral doubleLiteral = (DoubleLiteral) literal;
+ double doubleLiteralValue = doubleLiteral.getValue();
+
+ if (columnDataType == INT64) {
+ if (doubleLiteralValue > Long.MAX_VALUE) {
+ return constructFilterForGreaterThanMax(operator, measurementIndex);
+ }
+ if (doubleLiteralValue < Long.MIN_VALUE) {
+ return constructFilterForLessThanMin(operator, measurementIndex);
+ }
+ return constructFilterFromDouble(operator, doubleLiteralValue,
measurementIndex, type);
+
+ } else if (columnDataType == INT32) {
+ if (doubleLiteralValue > Integer.MAX_VALUE) {
+ return constructFilterForGreaterThanMax(operator, measurementIndex);
+ }
+
+ if (doubleLiteralValue < Integer.MIN_VALUE) {
+ return constructFilterForLessThanMin(operator, measurementIndex);
+ }
+ return constructFilterFromDouble(operator, doubleLiteralValue,
measurementIndex, type);
+ }
+ }
Review Comment:
The tree Model use the String type that accepts the input literal in
substance, while the table model use the double type that accepts the literal
input, so the rounding approach is different
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]