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


##########
fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java:
##########
@@ -159,23 +192,234 @@ 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 
handledConjunctVals) throws AnalysisException;
+    }
+
+    private static class InPredicateHandler implements ConjunctHandler {
+        public static final InPredicateHandler INSTANCE = new 
InPredicateHandler();
+
+        private InPredicateHandler() {
+        }
+
+        public static InPredicateHandler getInstance() {
+            return INSTANCE;

Review Comment:
   remove this function, use InPredicateHandler.INSTANCE directly



##########
fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExecutor.java:
##########
@@ -159,23 +192,234 @@ 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 
handledConjunctVals) throws AnalysisException;
+    }
+
+    private static class InPredicateHandler implements ConjunctHandler {
+        public static final InPredicateHandler INSTANCE = new 
InPredicateHandler();
+
+        private InPredicateHandler() {
+        }
+
+        public static InPredicateHandler getInstance() {
+            return INSTANCE;
+        }
+
+        @Override
+        public int handle(Expr expr, List<Expr> conjunctVals, int 
handledConjunctVals) 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(handledConjunctVals++));
+                } else {
+                    Preconditions.checkState(false, "Should contains literal 
in " + inPredicate.toSqlImpl());
+                }
+            }
+            return handledConjunctVals;
+        }
+    }
+
+    private static class BinaryPredicateHandler implements ConjunctHandler {
+        public static final BinaryPredicateHandler INSTANCE = new 
BinaryPredicateHandler();
+
+        private BinaryPredicateHandler() {
+        }
+
+        public static BinaryPredicateHandler getInstance() {

Review Comment:
   remove



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to