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


##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -44,13 +45,36 @@ use kernels::{
 };
 
 /// Binary expression
-#[derive(Debug, Clone, Eq)]
+#[derive(Clone, Eq)]
 pub struct BinaryExpr {
     left: Arc<dyn PhysicalExpr>,
     op: Operator,
     right: Arc<dyn PhysicalExpr>,
     /// Specifies whether an error is returned on overflow or not
     fail_on_overflow: bool,
+    /// Lazily computed on first use, so walking the children is not repeated
+    /// for every batch. Children never change after construction, and every
+    /// constructor starts with an empty cache, so it never goes stale.
+    children_volatility: OnceLock<ChildrenVolatility>,

Review Comment:
   this physical expression is not only for AND and OR, but many many Binary 
Expr so adding the calculation for volatility in every one is not needed
   
   also running many optimization before this actually needed will cause the 
entire expression tree every time while only needed for actual evaluation 



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