jayzhan211 commented on code in PR #11564:
URL: https://github.com/apache/datafusion/pull/11564#discussion_r1687256081


##########
datafusion/physical-expr-common/src/aggregate/mod.rs:
##########
@@ -81,6 +86,61 @@ pub fn create_aggregate_expr(
         .map(|e| e.expr.data_type(schema))
         .collect::<Result<Vec<_>>>()?;
 
+    let ordering_fields = ordering_fields(ordering_req, &ordering_types);
+    let name = name.into();
+
+    Ok(Arc::new(AggregateFunctionExpr {
+        fun: fun.clone(),
+        args: input_phy_exprs.to_vec(),
+        logical_args: input_exprs.to_vec(),
+        data_type: fun.return_type(&input_exprs_types)?,
+        name,
+        schema: schema.clone(),
+        dfschema: DFSchema::empty(),
+        sort_exprs: sort_exprs.to_vec(),
+        ordering_req: ordering_req.to_vec(),
+        ignore_nulls,
+        ordering_fields,
+        is_distinct,
+        input_type: input_exprs_types[0].clone(),
+        is_reversed,
+    }))
+}
+
+#[allow(clippy::too_many_arguments)]
+// This is not for external usage, consider creating with 
`create_aggregate_expr` instead.
+pub fn create_aggregate_expr_with_dfschema(

Review Comment:
   Great! Tracked in #11543. 
   



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