asolimando commented on PR #27597:
URL: https://github.com/apache/datafusion/pull/27597#issuecomment-7049002958

   > I reproduced an `ORDER BY` regression on `a2b0c6e4`. With the same two-row 
CSV and one partition, the base commit (`c6c1cc31`) keeps `SortExec` and 
returns `t = 1, 2`. The PR removes `SortExec` and returns `t = 2, 1`.
   [...]
   
   Thanks @shihchengwei-lab, I reproduced it. The cause is not in this PR 
though: the ordering check accepts a nullable `UNIQUE` key column when it is 
neither the first nor the last column of the ordering. `main` already returns 
wrong results when the key is not remapped, for example with `SELECT a, b, c, v 
FROM reorder ORDER BY a, b, c, v` on your table. This PR only exposes the same 
check in your query, as a side effect of remapping the key correctly, I'd 
therefore consider the two bugs as independent.
   
   I filed #27619 and opened #27620 with the fix you suggested: a `UNIQUE` 
constraint is used only if none of its key columns is nullable.
   
   cc: @2010YOUY01 as it might be quick for you to review #27620 too, since you 
know the context and the PR is small


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