jayzhan211 commented on code in PR #10091:
URL: 
https://github.com/apache/arrow-datafusion/pull/10091#discussion_r1566568252


##########
datafusion/functions-aggregate/src/first_last.rs:
##########
@@ -99,19 +130,37 @@ impl AggregateUDFImpl for FirstValue {
         let mut all_sort_orders = vec![];
 
         // Construct PhysicalSortExpr objects from Expr objects:
+        // TODO: Reuse `create_physical_sort_expr`
         let mut sort_exprs = vec![];
         for expr in acc_args.sort_exprs {
-            if let Expr::Sort(sort) = expr {
-                if let Expr::Column(col) = sort.expr.as_ref() {
+            if let Expr::Sort(Sort {
+                expr,
+                asc,
+                nulls_first,
+            }) = expr
+            {
+                if let Expr::Column(col) = expr.as_ref() {
                     let name = &col.name;
                     let e = expressions::column::col(name, acc_args.schema)?;
                     sort_exprs.push(PhysicalSortExpr {
                         expr: e,
                         options: SortOptions {
-                            descending: !sort.asc,
-                            nulls_first: sort.nulls_first,
+                            descending: !asc,
+                            nulls_first: *nulls_first,
                         },
                     });
+                } else if let Expr::Alias(alias) = expr.as_ref() {

Review Comment:
   Filed #10074 to see how to arrange the code here, replace with 
`create_physical_sort_expr` or others



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

Reply via email to