cloud-fan commented on a change in pull request #24331: [SPARK-19712][SQL] 
Pushdown LeftSemi/LeftAnti below join
URL: https://github.com/apache/spark/pull/24331#discussion_r276069981
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/LeftSemiAntiJoinPushDownSuite.scala
 ##########
 @@ -314,4 +315,116 @@ class LeftSemiPushdownSuite extends PlanTest {
     val optimized = Optimize.execute(originalQuery.analyze)
     comparePlans(optimized, originalQuery.analyze)
   }
+
+  Seq(LeftSemi, LeftAnti).foreach { case outerJT =>
+    Seq(Inner, LeftOuter, Cross, RightOuter).foreach { case innerJT =>
+      test(s"$outerJT pushdown with empty join condition join type $innerJT") {
+        val joinedRelation = testRelation1.join(testRelation2, joinType = 
innerJT, None)
+        val originalQuery = joinedRelation.join(testRelation, joinType = 
outerJT, None)
+        val optimized = Optimize.execute(originalQuery.analyze)
+
+        val correctAnswer = if (innerJT == RightOuter) {
+          val pushedDownJoin = testRelation2.join(testRelation, joinType = 
outerJT, None)
+          testRelation1.join(pushedDownJoin, joinType = innerJT, None)
+        } else {
+          val pushedDownJoin = testRelation1.join(testRelation, joinType = 
outerJT, None)
+          pushedDownJoin.join(testRelation2, joinType = innerJT, None)
+        }
+        comparePlans(optimized, correctAnswer)
+      }
+    }
+  }
+
+  Seq(Some('d === 'e), None).foreach { case innerJoinCond =>
+    Seq(LeftSemi, LeftAnti).foreach { case outerJT =>
+      Seq(Inner, LeftOuter, Cross).foreach { case innerJT =>
 
 Review comment:
   nvm, I was wrong

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to