jayzhan211 commented on code in PR #27771:
URL: https://github.com/apache/datafusion/pull/27771#discussion_r4729598582
##########
datafusion/physical-optimizer/src/join_selection.rs:
##########
@@ -340,13 +346,90 @@ fn statistical_join_selection_subrule(
None
};
- Ok(if let Some(transformed) = transformed {
- Transformed::yes(transformed)
- } else {
- Transformed::no(plan)
+ Ok(match transformed {
+ Some(transformed) => match keep_satisfied_requirements(&plan,
transformed)? {
+ Some(transformed) => Transformed::yes(transformed),
+ None => Transformed::no(plan),
+ },
+ None => Transformed::no(plan),
})
}
+/// Makes `new`, which replaces the join `old` over the same inputs, keep the
+/// order and distribution requirements that `old`'s inputs satisfy, because
+/// nothing restores them once `EnsureRequirements` has run.
+///
+/// A swap can make an input with several partitions the build side, which
Review Comment:
Yes: `None` means the rewritten join would break a requirement the old
join's inputs met, so `JoinSelection` keeps the old join. The doc comment now
says that in its first sentence.
--
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]