-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-13067: [C++][Compute] Implement integer to decimal cast #11045
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
|
LGTM. Thanks for resolving this issue. |
lidavidm
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 for doing this.
|
|
||
| options.to_type = decimal256(76, 67); | ||
| CheckCastFails(ArrayFromJSON(int32(), "[0]"), options); | ||
| } |
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.
Should we file a follow up issue to allow truncation via an unsafe cast in these cases?
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.
Sure, will do.
| CheckDispatchBest(name, {int64(), decimal128(1, 0)}, | ||
| {decimal128(1, 0), decimal128(1, 0)}); | ||
| CheckDispatchBest(name, {decimal128(1, 0), int64()}, | ||
| {decimal128(1, 0), decimal128(1, 0)}); |
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.
Hmm, so an int64 is cast to a 1-digit decimal? Unrelated to this PR surely, but I'm a bit surprised :-)
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.
I think this is testing that given an integer and a decimal, the integer is cast to a decimal of the same width/precision/scale.
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.
But surely the actual cast from int64 to decimal128(1,0) will fail in the precision check?
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.
Ah, right. Maybe we want the cast logic to be smarter about that, then. As you said, though, that can be tackled separately.
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.
Jira issue created
https://issues.apache.org/jira/browse/ARROW-13856
Closes apache#11045 from cyb70289/13067-int2dec Authored-by: Yibo Cai <yibo.cai@arm.com> Signed-off-by: Yibo Cai <yibo.cai@arm.com>
No description provided.