File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
main/scala/org/apache/spark/sql
test/scala/org/apache/spark/sql Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1018,6 +1018,11 @@ class Dataset[T] private[sql](
10181018 catalyst.expressions.EqualTo (
10191019 withPlan(plan.left).resolve(a.name),
10201020 withPlan(plan.right).resolve(b.name))
1021+ case catalyst.expressions.EqualNullSafe (a : AttributeReference , b : AttributeReference )
1022+ if a.sameRef(b) =>
1023+ catalyst.expressions.EqualNullSafe (
1024+ withPlan(plan.left).resolve(a.name),
1025+ withPlan(plan.right).resolve(b.name))
10211026 }}
10221027
10231028 withPlan {
Original file line number Diff line number Diff line change @@ -287,4 +287,12 @@ class DataFrameJoinSuite extends QueryTest with SharedSQLContext {
287287 dfOne.join(dfTwo, $" a" === $" b" , " left" ).queryExecution.optimizedPlan
288288 }
289289 }
290+
291+ test(" SPARK-24385: Resolve ambiguity in self-joins with EqualNullSafe" ) {
292+ withSQLConf(SQLConf .CROSS_JOINS_ENABLED .key -> " false" ) {
293+ val df = spark.range(2 )
294+ // this throws an exception before the fix
295+ df.join(df, df(" id" ) <=> df(" id" )).queryExecution.optimizedPlan
296+ }
297+ }
290298}
You can’t perform that action at this time.
0 commit comments