rluvaton commented on code in PR #27302:
URL: https://github.com/apache/datafusion/pull/27302#discussion_r4526817324


##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -93,9 +118,17 @@ impl BinaryExpr {
             op: self.op,
             right: self.right,
             fail_on_overflow,
+            children_volatility: OnceLock::new(),
         }
     }
 
+    fn children_volatility(&self) -> ChildrenVolatility {
+        *self.children_volatility.get_or_init(|| ChildrenVolatility {
+            left: is_volatile(&self.left),

Review Comment:
   Nested `AND`s don't each handle it themselves: `evaluate_conjunction` 
flattens the whole chain and the top node evaluates every conjunct, so the 
inner `AND`'s evaluate never runs. In `x AND (v AND y)`, `v` is evaluated after 
`x` has decided some rows, and whether to pre-select it depends on `v`'s 
volatility, which is the inner `AND`'s left. `OR` isn't flattened, so for `OR` 
only right matters.



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