kosiew commented on code in PR #21068:
URL: https://github.com/apache/datafusion/pull/21068#discussion_r3026162087


##########
datafusion/physical-plan/src/joins/utils.rs:
##########
@@ -855,6 +855,22 @@ pub(crate) fn need_produce_result_in_final(join_type: 
JoinType) -> bool {
     )
 }
 
+/// Returns true when an empty build side necessarily produces an empty result.
+///
+/// This is the shared source of truth for both state-machine short-circuiting
+/// and `build_batch_empty_build_side`.
+pub(crate) fn empty_build_side_produces_empty_result(join_type: JoinType) -> 
bool {
+    matches!(
+        join_type,
+        JoinType::Inner
+            | JoinType::Left
+            | JoinType::LeftSemi
+            | JoinType::LeftAnti
+            | JoinType::LeftMark
+            | JoinType::RightSemi
+    )
+}
+

Review Comment:
   I agree this reads more like join semantics than a hash-join utility. Moving 
it onto `JoinType` as something like 
`JoinType::empty_build_side_produces_empty_result()` would make the call sites 
a bit clearer and keep the rule next to the other join-type predicates.
   



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