eldenmoon commented on code in PR #39468:
URL: https://github.com/apache/doris/pull/39468#discussion_r1724327098


##########
fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java:
##########
@@ -159,23 +191,181 @@ public static void 
directExecuteShortCircuitQuery(StmtExecutor executor,
                         .getMysqlChannel(), null, null);
     }
 
-    private static void updateScanNodeConjuncts(OlapScanNode scanNode, 
List<Expr> conjunctVals) {
-        for (int i = 0; i < conjunctVals.size(); ++i) {
-            BinaryPredicate binaryPredicate = (BinaryPredicate) 
scanNode.getConjuncts().get(i);
-            if (binaryPredicate.getChild(0) instanceof LiteralExpr) {
-                binaryPredicate.setChild(0, conjunctVals.get(i));
-            } else if (binaryPredicate.getChild(1) instanceof LiteralExpr) {
-                binaryPredicate.setChild(1, conjunctVals.get(i));
+    /*
+     * Interface for handling different conjunct types
+     */
+    private interface ConjunctHandler {
+        int handle(Expr expr, List<Expr> conjunctVals, int conjunctValsBegin) 
throws AnalysisException;
+    }
+
+    private static class InPredicateHandler implements ConjunctHandler {
+        @Override
+        public int handle(Expr expr, List<Expr> conjunctVals, int 
conjunctValsBegin) throws AnalysisException {
+            InPredicate inPredicate = (InPredicate) expr;
+            if (inPredicate.isNotIn()) {
+                throw new AnalysisException("Not support NOT IN predicate in 
point query");
+            }
+            for (int j = 1; j < inPredicate.getChildren().size(); ++j) {
+                if (inPredicate.getChild(j) instanceof LiteralExpr) {
+                    inPredicate.setChild(j, 
conjunctVals.get(conjunctValsBegin++));
+                } else {
+                    Preconditions.checkState(false, "Should contains literal 
in " + inPredicate.toSqlImpl());
+                }
+            }
+            return conjunctValsBegin;
+        }
+    }
+
+    private static class BinaryPredicateHandler implements ConjunctHandler {
+        @Override
+        public int handle(Expr expr, List<Expr> conjunctVals, int 
conjunctValsBegin) throws AnalysisException {
+            BinaryPredicate binaryPredicate = (BinaryPredicate) expr;
+            Expr left = binaryPredicate.getChild(0);
+            Expr right = binaryPredicate.getChild(1);
+
+            if (isDeleteSign(left) || isDeleteSign(right)) {
+                return conjunctValsBegin;
+            }
+
+            if (isLiteralExpr(left)) {
+                binaryPredicate.setChild(0, 
conjunctVals.get(conjunctValsBegin++));
+            } else if (isLiteralExpr(right)) {
+                binaryPredicate.setChild(1, 
conjunctVals.get(conjunctValsBegin++));
             } else {
                 Preconditions.checkState(false, "Should contains literal in " 
+ binaryPredicate.toSqlImpl());
             }
+            return conjunctValsBegin;
         }
+
+        private boolean isLiteralExpr(Expr expr) {
+            return expr instanceof LiteralExpr;
+        }
+
+        private boolean isDeleteSign(Expr expr) {
+            return expr instanceof SlotRef && ((SlotRef) 
expr).getColumnName().equalsIgnoreCase(Column.DELETE_SIGN);
+        }
+    }
+
+    private static void updateScanNodeConjuncts(OlapScanNode scanNode, 
List<Expr> conjunctVals) {
+        List<Expr> conjuncts = scanNode.getConjuncts();
+        Map<Class<? extends Expr>, ConjunctHandler> handlers = 
Maps.newHashMap();
+        handlers.put(InPredicate.class, new InPredicateHandler());

Review Comment:
   handlers should be static variable and init in static way



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to