fix: fixes trig function order by #11559
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #11552
Rationale for this change
The
assert!(datatype.is_primitive());
is getting hit innew_negative_one
, but as far as I can tell isn't needed. There's a match statement right below that handles the datatype.Without the assert these functions seem to work properly. That said, I'm a little confused why it's working exactly. The datatypes coming through are
Datatype::Null
which caused the assertion error but seemingly isn't causing errors in the match statement.I'm also working on a branch https://github.com/apache/datafusion/compare/main...tshauck:arrow-datafusion:add-unary-udf-bounds?expand=1 that I think is a more complete way to solve this problem because currently unary functions don't report their bounds which I think is what ordering relies on to get its data type and means nested trig functions can work for ordering.
What changes are included in this PR?
Removed
datatype.is_primative()
asserts where the datatype is immediately matched on. I think it'd generally be better to handle unexpected datatypes that way for the error propagation vs asserting, which can lead to panics at query time.Are these changes tested?
I added tests from the ticket that were reported as panicking.
Are there any user-facing changes?
No