[
https://issues.apache.org/jira/browse/ARROW-6990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17152086#comment-17152086
]
Antoine Pitrou commented on ARROW-6990:
---------------------------------------
This should work now:
{code:python}
>>> arr = pa.array([Decimal('3.14'), None], type=pa.decimal128(19, 4))
>>>
>>>
>>> arr
>>>
>>>
<pyarrow.lib.Decimal128Array object at 0x7f02c0fd61a0>
[
3.1400,
null
]
>>> arr.cast(pa.decimal128(12, 4))
>>>
>>>
<pyarrow.lib.Decimal128Array object at 0x7f02c0fec750>
[
3.1400,
null
]
>>> arr.cast(pa.decimal128(12, 3))
>>>
>>>
<pyarrow.lib.Decimal128Array object at 0x7f02c0f6bb40>
[
3.140,
null
]
>>> arr.cast(pa.decimal128(12, 1))
>>>
>>>
Traceback (most recent call last):
[...]
ArrowInvalid: Rescaling decimal value would cause data loss
>>> arr.cast(pa.decimal128(2, 3))
>>>
>>>
Traceback (most recent call last):
[...]
ArrowInvalid: Decimal value does not fit in precision
{code}
> [C++] Support casting between decimal types with compatible precision/scales
> ----------------------------------------------------------------------------
>
> Key: ARROW-6990
> URL: https://issues.apache.org/jira/browse/ARROW-6990
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Micah Kornfield
> Priority: Major
>
> This seems like a reasonable thing to support and showed up as a question on
> the user mailing list (through some sort of python code).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)