alpass163 commented on code in PR #16917:
URL: https://github.com/apache/iotdb/pull/16917#discussion_r2626001546


##########
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, the columnDataType INT64 or 
INT32 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);
+      }
+    }
+
+    if (literal instanceof LongLiteral && columnDataType == INT32) {
+      return constructValueFilter(operator, literal, LongType.INT64, 
measurementIndex);
+    }

Review Comment:
   transform the int32 to int64 is compatitable, and the long filter also 
allows int32 column



-- 
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]

Reply via email to