liukun4515 commented on code in PR #4411:
URL: https://github.com/apache/arrow-datafusion/pull/4411#discussion_r1034542438


##########
datafusion/optimizer/src/limit_push_down.rs:
##########
@@ -192,6 +196,18 @@ impl OptimizerRule for LimitPushDown {
             LogicalPlan::Join(join) => {
                 let limit = fetch + skip;
                 let new_join = match join.join_type {
+                    JoinType::Left | JoinType::Right | JoinType::Full
+                        if is_no_join_condition(join) =>
+                    {
+                        // push left and right
+                        push_down_join(join, Some(limit), Some(limit))
+                    }
+                    JoinType::LeftSemi | JoinType::LeftAnti
+                        if is_no_join_condition(join) =>
+                    {
+                        // push left
+                        push_down_join(join, Some(limit), None)
+                    }
                     JoinType::Left => push_down_join(join, Some(limit), None),
                     JoinType::Right => push_down_join(join, None, Some(limit)),

Review Comment:
   > remove these
   
   ```
   JoinType::Left | JoinType::Right | JoinType::Full
                           if is_no_join_condition(join) =>
   ```
   
   the `on condition` is empty, the rule can be applied, but if the `on 
condition` is not empty, 
   
   ```
        JoinType::Left => push_down_join(join, Some(limit), None),
                       JoinType::Right => push_down_join(join, None, 
Some(limit)),
   ```
   can be applied.
   
   cc @jackwener 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to