berkaysynnada commented on code in PR #15563: URL: https://github.com/apache/datafusion/pull/15563#discussion_r2033512360
########## datafusion/physical-expr/src/equivalence/properties/mod.rs: ########## @@ -575,10 +576,35 @@ impl EquivalenceProperties { // From the analysis above, we know that `[a ASC]` is satisfied. Then, // we add column `a` as constant to the algorithm state. This enables us // to deduce that `(b + c) ASC` is satisfied, given `a` is constant. - eq_properties = eq_properties - .with_constants(std::iter::once(ConstExpr::from(normalized_req.expr))); + eq_properties = eq_properties.with_constants(std::iter::once( + ConstExpr::from(Arc::clone(&normalized_req.expr)), + )); } - true + + // All requirements are satisfied. + normalized_reqs.len() + } + + /// Determines the longest prefix of `reqs` that is satisfied by the existing ordering. + /// Returns that prefix as a new `LexRequirement`, and a boolean indicating if all the requirements are satisfied. + pub fn extract_matching_prefix( + &self, + reqs: &LexRequirement, + ) -> (LexRequirement, bool) { Review Comment: ``` SortExec: [expr: [a,b]] --FilterExec: [a=x] // x normalizes to a ----ScanExec: [... output_ordering: [x,c]] ``` While SortExec deciding its common_prefix_count, it has an input equivalence properties: equivalent column: [a,x] ordering: [x,c] So, the normalization is not lost actually, but we need to make a reverse requirement-satisfy check. I don't think this is a blocker for this PR, I'm just keeping on to achieve a flawless structure. Because keeping more input dependent fields in an operator brings more trouble while keeping things in-sync as I've experienced so far. -- 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