alamb commented on code in PR #10714:
URL: https://github.com/apache/datafusion/pull/10714#discussion_r1621348097


##########
datafusion/sqllogictest/test_files/distinct_on.slt:
##########
@@ -143,3 +143,39 @@ LIMIT 3;
 -25 15295
 45 15673
 -72 -11122
+
+# test distinct on

Review Comment:
   👍 



##########
datafusion/optimizer/src/replace_distinct_aggregate.rs:
##########
@@ -94,10 +96,18 @@ impl OptimizerRule for ReplaceDistinctWithAggregate {
             })) => {
                 let expr_cnt = on_expr.len();
 
+                let first_value_udaf = func_registry.udaf("first_value")?;
                 // Construct the aggregation expression to be used to fetch 
the selected expressions.
-                let aggr_expr = select_expr
-                    .into_iter()
-                    .map(|e| first_value(vec![e], false, None, 
sort_expr.clone(), None));
+                let aggr_expr = select_expr.into_iter().map(|e| {

Review Comment:
   this change is the reason for this PR I think -- to avoid the hard coded 
dependency on `first_value`... 
   
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to