alamb commented on code in PR #13128:
URL: https://github.com/apache/datafusion/pull/13128#discussion_r1825040266


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -1681,9 +1690,14 @@ impl<'a, S: SimplifyInfo> TreeNodeRewriter for 
Simplifier<'a, S> {
     }
 }
 
-fn has_common_conjunction(lhs: &Expr, rhs: &Expr) -> bool {
-    let lhs: HashSet<&Expr> = iter_conjunction(lhs).collect();
-    iter_conjunction(rhs).any(|e| lhs.contains(&e))
+fn has_common_conjunction(lhs: &Expr, rhs: &Expr) -> Result<bool, 
DataFusionError> {
+    let lhs_set: HashSet<&Expr> = iter_conjunction(lhs).collect();
+    for e in iter_conjunction(rhs) {
+        if lhs_set.contains(&e) && !e.is_volatile()? {

Review Comment:
   I looked a little more at `Expr::is_volatile` and I actually think it can't 
return any errors. If we changed the signature I think this PR would be 
significantly simpler
   
   



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