wiedld commented on PR #12414:
URL: https://github.com/apache/datafusion/pull/12414#issuecomment-2361387578

   > I believe you don't need to add a new logic for sort expr's. You should 
only focus on the following conversion, when constant expressions appear as the 
global order of the other children:
   > 
   > ```
   > LEFT: orderings: [[a]], constants: [c] → orderings: [[a, c], [c, a]], 
constants: []
   > RIGHT: orderings: [[c]], constants: [a] → orderings: [[c, a], [a, c]], 
constants: []
   > ```
   
   I think this is due to how I explained the issue. The actual children are:
   ```
   LEFT: orderings: [[a]], constants: [], NULL as c  (but is not named as a 
constant on the child)
   RIGHT: orderings: [[c]], constants: [], NULL as a (but is not named as a 
constant on the child)
   ```
   
   That comes out of this query reproducer, where we have two fields a and a0, 
which are (constant) nulls on alternating sides:
   ```
   select * from (select b, c, a, NULL::int as a0 from ordered_table order by 
a, c) t1
   union all
   select * from (select b, c, NULL::int as a, a0 from ordered_table order by 
a0, c) t2
   order by d, c, a, a0, b
   limit 2;
   ```
   
   I added to the complexity by trying to handle a generalized case, but I 
think what we want is a special casing.


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