alamb commented on code in PR #14821: URL: https://github.com/apache/datafusion/pull/14821#discussion_r1973393828
########## datafusion/physical-expr/src/equivalence/properties.rs: ########## @@ -22,7 +22,9 @@ use std::slice::Iter; use std::sync::Arc; use std::{fmt, mem}; -use crate::equivalence::class::{const_exprs_contains, AcrossPartitions}; +use crate::equivalence::class::{ Review Comment: Looking through the properties.rs file, it seems like it is getting huge -- I will file a follow on ticket about that ########## datafusion/physical-expr/src/equivalence/class.rs: ########## @@ -216,6 +216,17 @@ pub fn const_exprs_contains( .any(|const_expr| const_expr.expr.eq(expr)) } +/// Checks whether `expr` is among in the uniform `const_exprs`. +pub fn uniform_const_exprs_contains( + const_exprs: &[ConstExpr], + expr: &Arc<dyn PhysicalExpr>, +) -> bool { + const_exprs.iter().any(|const_expr| { + const_expr.expr.eq(expr) + && const_expr.across_partitions() != AcrossPartitions::Heterogeneous Review Comment: Something like this (which is how other parts of the code check this): ```diff index 1e1266b7a..e9e7eb2ca 100644 --- a/datafusion/physical-expr/src/equivalence/class.rs +++ b/datafusion/physical-expr/src/equivalence/class.rs @@ -223,7 +223,10 @@ pub fn uniform_const_exprs_contains( ) -> bool { const_exprs.iter().any(|const_expr| { const_expr.expr.eq(expr) - && const_expr.across_partitions() != AcrossPartitions::Heterogeneous + && matches!( + const_expr.across_partitions(), + AcrossPartitions::Uniform { .. } + ) }) } ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org