epsio-banay commented on code in PR #13039:
URL: https://github.com/apache/datafusion/pull/13039#discussion_r1810602090


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -2889,7 +2890,9 @@ impl DistinctOn {
         // Check that the left-most sort expressions are the same as the `ON` 
expressions.
         let mut matched = true;
         for (on, sort) in self.on_expr.iter().zip(sort_expr.iter()) {
-            if on != &sort.expr {
+            if normalize_col(on.clone(), &self.input)?

Review Comment:
   Sorry for wasting your time on these tests and thank you for looking into it.
   Apparently the bug I experienced was just a little bit different - there is 
a bug in column normalization where we don't normalize field qualifiers 
correctly.
   
   for the query "SELECT DISTINCT ON (t.a) t.a AS alert_id FROM public.t ORDER 
BY t.a"
   the sort expression was normalized to public.t.a but the distinct on 
expression was normalized to t.a.
   
   I added a fix for that in the `normalize_with_schemas_and_ambiguity_check` 
function.
   But I think this PR will now probably effect most of the logical plans that 
datafusion will generate.
   



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