5960686e79
## What changes were proposed in this pull request? Right now the calculation of SortMergeJoinExec's outputOrdering relies on the fact that its children have already been sorted on the join keys, while this is often not true until EnsureRequirements has been applied. So we ended up not getting the correct outputOrdering during physical planning stage before Sort nodes are added to the children. For example, J = {A join B on key1 = key2} 1. if A is NOT ordered on key1 ASC, J's outputOrdering should include "key1 ASC" 2. if A is ordered on key1 ASC, J's outputOrdering should include "key1 ASC" 3. if A is ordered on key1 ASC, with sameOrderExp=c1, J's outputOrdering should include "key1 ASC, sameOrderExp=c1" So to fix this I changed the behavior of <code>getKeyOrdering(keys, childOutputOrdering)</code> to: 1. If the childOutputOrdering satisfies (is a superset of) the required child ordering => childOutputOrdering 2. Otherwise => required child ordering In addition, I organized the logic for deciding the relationship between two orderings into SparkPlan, so that it can be reused by EnsureRequirements and SortMergeJoinExec, and potentially other classes. ## How was this patch tested? Added new test cases. Passed all integration tests. Author: maryannxue <maryann.xue@gmail.com> Closes #19281 from maryannxue/spark-21998. |
||
---|---|---|
.. | ||
main | ||
test |