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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/predicate/ConvertPredicateToFilterVisitor.java:
##########
@@ -265,7 +273,131 @@ private <T extends Comparable<T>> Filter 
constructCompareFilter(
       Context context) {
     PartialPath path = ((TimeSeriesOperand) timeseriesOperand).getPath();
     int measurementIndex = context.getMeasurementIndex(path.getMeasurement());
-    TSDataType dataType = context.getType(path);
+    TSDataType columnDataType = context.getType(path);
+
+    ConstantOperand constantLiteral = (ConstantOperand) constantOperand;
+    TSDataType constantDataType = constantLiteral.getDataType();
+    String constantString = constantLiteral.getValueString();
+    if (constantDataType == DOUBLE && NumberUtils.isCreatable(constantString)) 
{
+      BigDecimal constantDecimal = new BigDecimal(constantString);
+
+      if (columnDataType == INT64) {
+        if (constantDecimal.compareTo(new BigDecimal(Long.MAX_VALUE)) > 0) {
+          return constructFilterForGreaterThanMax(expressionType, 
measurementIndex);
+        }
+        if (constantDecimal.compareTo(new BigDecimal(Long.MIN_VALUE)) < 0) {
+          return constructFilterForLessThanMin(expressionType, 
measurementIndex);
+        }
+        return constructFilterFromDouble(
+            expressionType, constantOperand, measurementIndex, columnDataType);
+
+      } else if (columnDataType == INT32) {
+        if (constantDecimal.compareTo(new BigDecimal(Integer.MAX_VALUE)) > 0) {
+          return constructFilterForGreaterThanMax(expressionType, 
measurementIndex);
+        }
+        if (constantDecimal.compareTo(new BigDecimal(Integer.MIN_VALUE)) < 0) {
+          return constructFilterForLessThanMin(expressionType, 
measurementIndex);
+        }
+        return constructFilterFromDouble(
+            expressionType, constantOperand, measurementIndex, columnDataType);
+      }
+    }

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