fix: fixes trig function order by#11559
Merged
alamb merged 3 commits intoapache:mainfrom Jul 21, 2024
Merged
Conversation
alamb
approved these changes
Jul 20, 2024
|
|
||
| /// Create an one value in the given type. | ||
| pub fn new_one(datatype: &DataType) -> Result<ScalarValue> { | ||
| assert!(datatype.is_primitive()); |
Contributor
There was a problem hiding this comment.
removing the assert (as any unhandled type will cause a runtime error) makes a lot of sense to me.
Lordworms
pushed a commit
to Lordworms/arrow-datafusion
that referenced
this pull request
Jul 23, 2024
* fix: remove assert * tests: add tests from ticket * tests: clean up table
wiedld
pushed a commit
to influxdata/arrow-datafusion
that referenced
this pull request
Jul 31, 2024
* fix: remove assert * tests: add tests from ticket * tests: clean up table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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::Nullwhich 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