ARROW-13067: [C++][Compute] Implement integer to decimal cast#11045
ARROW-13067: [C++][Compute] Implement integer to decimal cast#11045cyb70289 wants to merge 2 commits intoapache:masterfrom cyb70289:13067-int2dec
Conversation
|
LGTM. Thanks for resolving this issue. |
|
|
||
| options.to_type = decimal256(76, 67); | ||
| CheckCastFails(ArrayFromJSON(int32(), "[0]"), options); | ||
| } |
There was a problem hiding this comment.
Should we file a follow up issue to allow truncation via an unsafe cast in these cases?
| 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.
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.
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.
But surely the actual cast from int64 to decimal128(1,0) will fail in the precision check?
There was a problem hiding this comment.
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.
Closes apache#11045 from cyb70289/13067-int2dec Authored-by: Yibo Cai <[email protected]> Signed-off-by: Yibo Cai <[email protected]>
No description provided.