alamb commented on code in PR #5607:
URL: https://github.com/apache/arrow-datafusion/pull/5607#discussion_r1137331638


##########
datafusion/optimizer/src/eliminate_duplicated_expr.rs:
##########
@@ -41,15 +42,28 @@ impl OptimizerRule for EliminateDuplicatedExpr {
     ) -> Result<Option<LogicalPlan>> {
         match plan {
             LogicalPlan::Sort(sort) => {
+                let normalized_sort_keys = sort
+                    .expr
+                    .iter()
+                    .map(|e| match e {
+                        Expr::Sort(ExprSort { expr, .. }) => {
+                            Expr::Sort(ExprSort::new(expr.clone(), true, 
false))

Review Comment:
   I am not sure about always using `true`, `fase`
   
   Using the example
   ```sql
   select * from t1 order by id desc, id, name, id asc;
   select * from t1 order by id asc, id, name, id desc;
   ```
   
   Is the sort key always the same ? It seems like in the first query the sort 
key should be `id desc, name` and the second it should be `id asc, name`
   
   Maybe I am missing something



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