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


##########
datafusion/core/src/physical_plan/aggregates/mod.rs:
##########
@@ -356,6 +409,23 @@ impl AggregateExec {
         )?;
 
         let schema = Arc::new(schema);
+        let mut aggregator_requirement = None;
+        // Ordering requirement makes sense only in Partial and Single modes.

Review Comment:
   > This comment implies that an ORDER BY clause can not be done with a 
multi-step group by (which makes sense).
   > 
   > Given ordering doesn't make sense for AggregateMode::Final, did you 
consider returning an error if an ordering was supplied? (to fail fast, rather 
than ignore the field)?
   
   When we run the query 
   ```sql
   (ARRAY_AGG(amount ORDER BY ts)) AS amounts
   ```
   datafusion will produce plan
   ```
   AggregateExec(mode=Final)
     AggregateExec(mode=Partial)
   ```
   Both executors will receive `ORDER BY ts` as requirement. However, for Final 
mode requirement doesn't make sense. Raising Error in this case, is wrong (They 
will received requirement anyway), unless we change the creation of executor in 
the `Final` and `FinalPartitioned` mode. 



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to