rubenada opened a new pull request #1870: [CALCITE-3846]  EnumerableMergeJoin: 
wrong comparison of composite key with null values
URL: https://github.com/apache/calcite/pull/1870
 
 
   Jira: [CALCITE-3846](https://issues.apache.org/jira/browse/CALCITE-3846)
   
   EnumerableMergeJoin implementation expects its inputs to be sorted in 
ascending order, nulls last (see EnumerableMergeJoinRule). In case of a 
composite key, EnumerableMergeJoin will represent keys as `JavaRowFormat.LIST`, 
which is a comparable list, whose comparison is implemented via 
`FlatLists.ComparableListImpl#compare`. This method will compare both lists, 
item by item, but in will consider that a null item is less-than a non-null 
item. This is a de-facto nulls-first collation, which contradicts the 
pre-requisite of the mergeJoin algorithm.
   
   Proposed solution: merge join algorithm should not compare keys using 
compareTo method, instead an ad-hoc Comparator should be generated by 
EnumerableMergeJoin, similar to EnumerableSort approach (i.e. this Comparator 
could be null, in which case compareTo method will be used).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to