geoffreyclaude commented on code in PR #15563: URL: https://github.com/apache/datafusion/pull/15563#discussion_r2030894828
########## datafusion/physical-plan/src/sorts/sort.rs: ########## @@ -1066,22 +1071,33 @@ impl SortExec { } /// This function creates the cache object that stores the plan properties such as schema, equivalence properties, ordering, partitioning, etc. + /// It also returns the common sort prefix between the input and the sort expressions. fn compute_properties( input: &Arc<dyn ExecutionPlan>, sort_exprs: LexOrdering, preserve_partitioning: bool, - ) -> PlanProperties { + ) -> (PlanProperties, LexOrdering) { // Determine execution mode: let requirement = LexRequirement::from(sort_exprs); - let sort_satisfied = input + + let (sort_prefix, sort_satisfied) = input .equivalence_properties() - .ordering_satisfy_requirement(&requirement); + .extract_matching_prefix(&requirement); + + let sort_partially_satisfied = sort_satisfied || !sort_prefix.is_empty(); Review Comment: absolutely! In my first draft I didn't always compute the `sort_prefix` so the `OR` made sense. It's completely redundant now, I'll remove it. -- 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