alamb commented on code in PR #8107:
URL: https://github.com/apache/arrow-datafusion/pull/8107#discussion_r1389877302
##########
datafusion/physical-expr/src/equivalence.rs:
##########
@@ -869,9 +986,27 @@ impl EquivalenceProperties {
self.ordering_satisfy_requirement(&sort_requirements)
}
- /// Checks whether the given sort requirements are satisfied by any of the
- /// existing orderings.
+ /// Checks whether the given sort requirements are satisfied by any of the
existing orderings.
+ /// This function applies an implicit projection to itself before calling
`ordering_satisfy_requirement_helper`
+ /// to define the orderings of complex [`PhysicalExpr`]'s during analysis.
pub fn ordering_satisfy_requirement(&self, reqs: LexRequirementRef) ->
bool {
+ let exprs = reqs
+ .iter()
+ .map(|sort_req| sort_req.expr.clone())
+ .collect::<Vec<_>>();
+ let projection_mapping = self.implicit_projection_mapping(&exprs);
+ let projected_eqs =
+ self.project(&projection_mapping,
projection_mapping.output_schema());
+ if let Some(projected_reqs) =
projection_mapping.project_lex_reqs(reqs) {
Review Comment:
I guess I was trying to say that in general, for `ProjectionExec` and any
node that computes expressions, I would expect that we would have to use
`FuncMonotonicity` to determine if an expression of `x` is ordered by `expr(x)`
Maybe that would be a good thing to do as a follow on PR
--
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]