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


##########
datafusion/optimizer/src/limit_push_down.rs:
##########
@@ -192,6 +196,24 @@ 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) =>

Review Comment:
   > I wonder how often there will be no join conditions 🤔 that effectively 
then becomes a CROSS JOIN
   > 
   > To be clear I think the optimization is still correct, I just wonder how 
often it will appear in real queries
   
   Good question for this, in the current framework of optimizer in the 
datafusion, the `join` query will be converted to the `cross join` by other 
rule.
   
   The `limit push down` rule just do the best to optimize the plan.
   
   Some SQL are generated by the program, and the `join type` and `on 
condition` are added by the program, it will generate sql like ` select * from 
left_table right join right_table`.



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