findepi commented on code in PR #12177:
URL: https://github.com/apache/datafusion/pull/12177#discussion_r1734378071


##########
datafusion/optimizer/src/eliminate_duplicated_expr.rs:
##########
@@ -79,14 +51,15 @@ impl OptimizerRule for EliminateDuplicatedExpr {
         match plan {
             LogicalPlan::Sort(sort) => {
                 let len = sort.expr.len();
-                let unique_exprs: Vec<_> = sort
-                    .expr
-                    .into_iter()
-                    .map(|e| SortExprWrapper { expr: e })
-                    .collect::<IndexSet<_>>()
-                    .into_iter()
-                    .map(|wrapper| wrapper.expr)
-                    .collect();
+                let mut first_sort_by_expr: IndexMap<Expr, SortExpr> =
+                    IndexMap::default();
+                for s in &sort.expr {

Review Comment:
   thanks @jayzhan211! i see my mistake. 
   there was a SortExprWrapper struct, but i did remove it
   i restored SortExprWrapper code and adapted it. thus the code is different 
than in your comment, but the purpose was to make the diff smaller.
   
   see [restore 
SortExprWrapper](https://github.com/apache/datafusion/pull/12177/commits/9931e1c718139a84806c4e83530d6f2a27cb78be)
 commit
   or the full diff for that file 
https://github.com/apache/datafusion/pull/12177/files#diff-4740b5caba0e0f9addf958e3987a0f7745ab6f45e13dc213fec0e1304d057f0cL41
   as the result there are only minimal changes in `SortExprWrapper` and no 
changes within `impl OptimizerRule for EliminateDuplicatedExpr`



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