You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mingmwang (via GitHub)" <gi...@apache.org> on 2023/04/26 03:24:33 UTC

[GitHub] [arrow-datafusion] mingmwang commented on a diff in pull request #6084: Move Scalar Subquery validation logic to the Analyzer

mingmwang commented on code in PR #6084:
URL: https://github.com/apache/arrow-datafusion/pull/6084#discussion_r1177295506


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -484,6 +484,97 @@ impl LogicalPlan {
             _ => Ok(self),
         }
     }
+
+    /// Returns the maximum number of rows that this plan can output.
+    pub fn max_rows(self: &LogicalPlan) -> Option<usize> {
+        match self {
+            LogicalPlan::Projection(Projection { input, .. }) => input.max_rows(),
+            LogicalPlan::Filter(Filter { input, .. }) => input.max_rows(),
+            LogicalPlan::Window(Window { input, .. }) => input.max_rows(),
+            LogicalPlan::Aggregate(Aggregate {
+                input, group_expr, ..
+            }) => {
+                if group_expr.is_empty() {
+                    Some(1)
+                } else {
+                    input.max_rows()
+                }

Review Comment:
   Good point. I will try add this in this PR.



-- 
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: github-unsubscribe@arrow.apache.org

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