Kristofferjoha commented on PR #26747:
URL: https://github.com/apache/datafusion/pull/26747#issuecomment-6423062822

   @jayzhan211 Thank you for the review as always. Addressed the comments. 
While testing, I found another wrong-result case exposed by the broader 
equality rule.
   
   ```
   SET datafusion.execution.target_partitions = 1;
   
   CREATE TABLE lossy_topk AS VALUES (16777217), (16777216);
   
   SELECT r, x FROM (
     SELECT column1 AS r, CAST(column1 AS FLOAT) AS x
     FROM lossy_topk
     ORDER BY r
     LIMIT 1
   ) ORDER BY x;
   ```
   
   This should return r = 16777216, but with the broader equality rule it 
returns r = 16777217. Both integers cast to the same float value, and sort 
pushdown replaces the inner TopK[r] with TopK[x], changing which row survives 
the limit.
   
   I added a small fix to retain the inner TopK’s selection keys when they 
already satisfy the outer ordering, plus an exact-result regression test.


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