mustafasrepo commented on code in PR #10651:
URL: https://github.com/apache/datafusion/pull/10651#discussion_r1622430792


##########
datafusion/physical-expr-common/src/aggregate/mod.rs:
##########
@@ -333,11 +351,24 @@ impl AggregateExpr for AggregateFunctionExpr {
     }
 
     fn create_groups_accumulator(&self) -> Result<Box<dyn GroupsAccumulator>> {
-        self.fun.create_groups_accumulator()
+        let args = AccumulatorArgs {
+            data_type: &self.data_type,
+            schema: &self.schema,
+            ignore_nulls: self.ignore_nulls,
+            sort_exprs: &self.sort_exprs,
+            is_distinct: self.is_distinct,
+            input_type: &self.input_type,
+            args_num: self.args.len(),
+            name: &self.name,
+        };
+        self.fun.create_groups_accumulator(args)
     }
 
     fn order_bys(&self) -> Option<&[PhysicalSortExpr]> {
-        (!self.ordering_req.is_empty()).then_some(&self.ordering_req)
+        if self.fun.has_ordering_requirements() && 
!self.ordering_req.is_empty() {

Review Comment:
   I agree that, for most of the aggregate functions, 
`AggregateOrderSensitivity::Insensitive` is the correct behavior. However, I 
think the safest default choice is 
`AggregateOrderSensitivity::HardRequirement`. Also, as long as there is no 
requirement, default is not important. Hence, I think we can be strict in this 
choice.



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to