jayzhan211 opened a new pull request, #26884:
URL: https://github.com/apache/datafusion/pull/26884

   ## Which issue does this PR close?
   
   - Related to #26481. Found while checking plans right after 
`EnsureRequirements`; no issue filed.
   
   ## Rationale for this change
   
   `EquivalenceProperties` cannot tell that a plan sorted on `sqrt(a)` 
satisfies an ordering requirement on `sqrt(a)`. The same goes for `ln`, `log2`, 
`log10`, `acos`, `asin`, `acosh` and `atanh`. These functions cannot derive an 
ordering from their input when the input may be outside their domain (for 
`sqrt`, a negative `a`), so `get_properties` returns an error. 
`update_properties` propagated that error, which also discarded the ordering 
the expression already had from the plan.
   
   No plan in the test suite changes, but a requirement check on such a plan 
fails. For example, `ORDER BY ACOSH(SIN(v1))` in `scalar.slt` fails 
`SanityCheckPlan`'s check when the plan is checked right after 
`EnsureRequirements`.
   
   ## What changes are included in this PR?
   
   `update_properties` treats properties that cannot be derived from the 
children as unknown, instead of failing, so the node's own known ordering is 
kept.
   
   ## Are these changes tested?
   
   Yes. `test_known_ordering_when_expr_properties_fail` adds an ordering on 
`sqrt(a)` and checks that it is satisfied; it fails without this change. The 
full sqllogictest suite, TPC-H included, passes with no changes.
   
   ## Are there any user-facing changes?
   
   No.
   


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