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


##########
datafusion/optimizer/src/replace_distinct_aggregate.rs:
##########
@@ -99,17 +97,7 @@ impl OptimizerRule for ReplaceDistinctWithAggregate {
                 // Construct the aggregation expression to be used to fetch 
the selected expressions.
                 let aggr_expr = select_expr
                     .into_iter()
-                    .map(|e| {
-                        Expr::AggregateFunction(AggregateFunction::new(
-                            AggregateFunctionFunc::FirstValue,
-                            vec![e],
-                            false,
-                            None,
-                            sort_expr.clone(),
-                            None,
-                        ))
-                    })
-                    .collect::<Vec<Expr>>();
+                    .map(|e| first_value(vec![e], false, None, 
sort_expr.clone(), None));

Review Comment:
   I just noticed that we import functions-aggregate in optimizer for 
first_value, should we move this rule into functions-aggregate?



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