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


##########
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:
   Special double values will be intercepted during the earlier lexical parser 
stage, currently IoTDB does not support  special double values(NaN and 
Infinity.) 



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