maropu commented on a change in pull request #31630:
URL: https://github.com/apache/spark/pull/31630#discussion_r581608222



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -555,6 +559,8 @@ object LimitPushDown extends Rule[LogicalPlan] {
           join.copy(
             left = maybePushLocalLimit(exp, left),
             right = maybePushLocalLimit(exp, right))
+        case LeftSemi | LeftAnti if conditionOpt.isEmpty =>
+          join.copy(left = maybePushLocalLimit(exp, left))

Review comment:
       hm, in this case, we need the join itself?
   ```
   scala> sql("select * from l1").show()
   +----+
   |  id|
   +----+
   |   1|
   |   2|
   |null|
   +----+
   
   
   scala> sql("select * from r1").show()
   +----+
   |  id|
   +----+
   |   2|
   |null|
   +----+
   
   
   scala> sql("select * from l1 left semi join r1").show()
   +----+
   |  id|
   +----+
   |   1|
   |   2|
   |null|
   +----+
   
   
   scala> sql("select * from l1 left anti join r1").show()
   +---+
   | id|
   +---+
   +---+
   ```




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



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

Reply via email to