1. [SPARK-24495][SQL] EnsureRequirement returns wrong plan when reordering (details)
Commit e6bf325de1ea101264925deadb0476a65059e04a by gatorsmile
[SPARK-24495][SQL] EnsureRequirement returns wrong plan when reordering
equal keys
`EnsureRequirement` in its `reorder` method currently assumes that the
same key appears only once in the join condition. This of course might
not be the case, and when it is not satisfied, it returns a wrong plan
which produces a wrong result of the query.
added UT
Author: Marco Gaido <>
Closes #21529 from mgaido91/SPARK-24495.
(cherry picked from commit fdadc4be08dcf1a06383bbb05e53540da2092c63)
Signed-off-by: Xiao Li <>
The file was modifiedsql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala (diff)
The file was modifiedsql/core/src/test/scala/org/apache/spark/sql/execution/PlannerSuite.scala (diff)
The file was modifiedsql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala (diff)