2010YOUY01 commented on code in PR #18392:
URL: https://github.com/apache/datafusion/pull/18392#discussion_r2570896669


##########
datafusion/physical-plan/src/joins/piecewise_merge_join/exec.rs:
##########
@@ -462,9 +446,35 @@ impl PiecewiseMergeJoinExec {
         }
     }
 
-    // TODO
+    // Inner, Outer, Left, Right joins are swapped so that left side is larger 
than right
+    // Left Semi/Anti joins are not swapped while Right Semi/Anti joins are 
always swapped. This

Review Comment:
   Should we move this comment to `join_selection.rs`? The purpose of this API 
is just swap the child, and the core logics that decide when to swap lives in 
the caller (optimizer), so I think it's better to explain the rationale there.
   
   Also I feel for inner join, it's better to put the smaller side on the 
left/buffer, but in order to merge this PR sooner, I suggest to discuss it in a 
follow-up PR, we can optionally remove the reordering logic for classic joins.



##########
datafusion/physical-optimizer/src/join_selection.rs:
##########
@@ -256,59 +256,75 @@ fn statistical_join_selection_subrule(
     collect_threshold_byte_size: usize,
     collect_threshold_num_rows: usize,
 ) -> Result<Transformed<Arc<dyn ExecutionPlan>>> {
-    let transformed =
-        if let Some(hash_join) = plan.as_any().downcast_ref::<HashJoinExec>() {
-            match hash_join.partition_mode() {
-                PartitionMode::Auto => try_collect_left(
-                    hash_join,
-                    false,
-                    collect_threshold_byte_size,
-                    collect_threshold_num_rows,
-                )?
+    let transformed = if let Some(hash_join) =

Review Comment:
   This setting helps: setting (gear icon at top-right) -> 'hide whitespace'



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


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

Reply via email to