jackwener commented on code in PR #19288:
URL: https://github.com/apache/doris/pull/19288#discussion_r1185730728


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java:
##########
@@ -75,6 +75,12 @@ public static Set<Expression> 
extractConjunctionToSet(Expression expr) {
         return exprSet;
     }
 
+    public static Set<SlotReference> extractSlotToSet(Expression expr) {
+        Set<SlotReference> exprSet = Sets.newHashSet();
+        extract(expr, exprSet);
+        return exprSet;
+    }
+

Review Comment:
   use expr.getInputSlots()



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/ExpressionUtils.java:
##########
@@ -111,6 +117,16 @@ private static void extract(Class<? extends Expression> 
type, Expression expr, C
         }
     }
 
+    private static void extract(Expression expr, Set<SlotReference> 
allSlotExprs) {
+        if (expr instanceof SlotReference) {
+            allSlotExprs.add((SlotReference) expr);
+        } else {
+            for (Expression child : expr.children()) {
+                extract(child, allSlotExprs);
+            }
+        }
+    }
+

Review Comment:
   If we want to get all slots used by expr.
   
   ```java
   expr.getInputSlots()
   ```



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