morrySnow commented on code in PR #31875:
URL: https://github.com/apache/doris/pull/31875#discussion_r1522445959


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/PlanUtils.java:
##########
@@ -125,6 +126,28 @@ public static ImmutableSet<TableIf> 
getTableSet(LogicalPlan plan) {
         return resultSet;
     }
 
+    /**
+     * Check if slot is from the plan.
+     */
+    public static boolean checkSlotFrom(Plan plan, SlotReference slot) {
+        Set<LogicalCatalogRelation> tableSets = 
PlanUtils.getLogicalScanFromRootPlan((LogicalPlan) plan);
+        for (LogicalCatalogRelation table : tableSets) {
+            if (table.getOutputExprIds().contains(slot.getExprId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Check if the expression is a column reference.
+     */
+    public static boolean isColumnRef(Expression expr) {
+        return expr instanceof SlotReference
+                && ((SlotReference) expr).getColumn().isPresent()
+                && ((SlotReference) expr).getTable().isPresent();
+    }

Review Comment:
   use `Expression#isColumnFromTable`



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