-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-4957: [Rust] [DataFusion] Re-implement get_supertype #4019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@kszucs Please take a look when you can |
|
@paddyhoran @sunchao Some code cleanup that would be good to get into 0.13 |
uagashe-rms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
sunchao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @andygrove . Sorry for the late review.
| ))), | ||
| }, | ||
| use arrow::datatypes::DataType::*; | ||
| let d = if l == r { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the old implementation the super type of UInt16 and Int8 is None but now it is Int16. Why is that? Also do you know how C++ handles this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not statically compatible in C++ (safely). https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/cast.cc#L156-L208
It can be safe to cast, but it needs a runtime check.
| )); | ||
| } | ||
| } | ||
| assert_eq!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid comparing with string? whenever there's an error it is very hard to find out since you are comparing two huge strings.
| ))), | ||
| }, | ||
| use arrow::datatypes::DataType::*; | ||
| let d = if l == r { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not statically compatible in C++ (safely). https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/cast.cc#L156-L208
It can be safe to cast, but it needs a runtime check.
| Some(l.clone()) | ||
| } else if l == &Utf8 || r == &Utf8 { | ||
| Some(Utf8) | ||
| } else if is_signed_int(l) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is hard to follow, I'd rewrite this with small functions.
|
Can this PR be merged? |
|
I think there are a few pending comments to be resolved. @andygrove can you take a look? |
|
Sorry, I haven't had any spare time for a while due to work commitments. I am closing this and will try again another time. |
This PR re-implements get_supertype to be easier to read and maintain. It still only supports numeric types and string. After this PR is merged I will create new PRs to add rules for boolean and date/time.