mbutrovich commented on issue #26115:
URL: https://github.com/apache/datafusion/issues/26115#issuecomment-7134677289

   The same mismatch reaches a flat float key when another join key follows it. 
Sorting on `(f, i)` puts `(-0.0, 5)` before `(0.0, 1)`, but the join's 
comparator sees `(0.0, 5)` and `(0.0, 1)`, which are out of order. The join 
then misses the match for `(0.0, 1)`:
   
   ```sql
   CREATE TABLE a AS SELECT * FROM (VALUES (arrow_cast(-0.0, 'Float64'), 5), 
(arrow_cast(0.0, 'Float64'), 1)) t(f, i);
   CREATE TABLE b AS SELECT * FROM (VALUES (arrow_cast(0.0, 'Float64'), 1)) 
t(f, i);
   SET datafusion.optimizer.prefer_hash_join = false;
   SELECT * FROM a JOIN b ON a.f = b.f AND a.i = b.i;
   ```
   
   `HashJoinExec` returns the row `(0.0, 1, 0.0, 1)`, and `SortMergeJoinExec` 
returns no rows. So not planning sort-based joins for nested float keys would 
leave this case. Sorting by the normalized key, the first direction in the 
issue, covers both.


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