mustafasrepo commented on code in PR #7832:
URL: https://github.com/apache/arrow-datafusion/pull/7832#discussion_r1361538575


##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -1021,12 +1021,21 @@ impl ExecutionPlan for AggregateExec {
                     ..Default::default()
                 }
             }
-            _ => Statistics {
-                // the output row count is surely not larger than its input 
row count
-                num_rows: self.input.statistics().num_rows,
-                is_exact: false,
-                ..Default::default()
-            },
+            _ => {
+                let input_stats = self.input.statistics();
+                // Input statistics is exact and number of rows not greater 
than 1:
+                let is_exact = input_stats.is_exact
+                    && (input_stats
+                        .num_rows
+                        .map(|num_rows| num_rows <= 1)
+                        .unwrap_or(false));
+                Statistics {
+                    // the output row count is surely not larger than its 
input row count

Review Comment:
   Yes you are right. I think the safest way is to check `num_rows == 1`. 
Changed accordingly



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

Reply via email to