morristai commented on code in PR #26634:
URL: https://github.com/apache/datafusion/pull/26634#discussion_r4552772490
##########
datafusion/physical-optimizer/src/projection_pushdown.rs:
##########
@@ -433,6 +465,28 @@ impl<'a> JoinFilterRewriter<'a> {
}
}
+/// Returns the number of leading children of `expr` that are evaluated for
every row, or `None`
+/// if all children are. The remaining children may be skipped for some rows.
+///
+/// Mirrors `conditional_children` in the logical `CommonSubexprEliminate`
rule.
+fn always_evaluated_child_count(expr: &dyn PhysicalExpr) -> Option<usize> {
+ if let Some(case) = expr.downcast_ref::<CaseExpr>() {
+ // The children are the optional base expression, then each WHEN/THEN
pair, then the
+ // optional ELSE. Only the base expression and the first WHEN are
always evaluated.
+ Some(usize::from(case.expr().is_some()) + 1)
Review Comment:
fixed and added regression test in `nested_loop_join_conditional.slt`.
--
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]