You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Phillip Cloud (JIRA)" <ji...@apache.org> on 2018/04/03 21:32:00 UTC

[jira] [Assigned] (ARROW-2387) negative decimal values get spurious rescaling error

     [ https://issues.apache.org/jira/browse/ARROW-2387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phillip Cloud reassigned ARROW-2387:
------------------------------------

    Assignee: Phillip Cloud

> negative decimal values get spurious rescaling error
> ----------------------------------------------------
>
>                 Key: ARROW-2387
>                 URL: https://issues.apache.org/jira/browse/ARROW-2387
>             Project: Apache Arrow
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: ben w
>            Assignee: Phillip Cloud
>            Priority: Major
>
> {code:java}
> $ python
> Python 2.7.12 (default, Nov 20 2017, 18:23:56)
> [GCC 5.4.0 20160609] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import pyarrow as pa, decimal
> >>> one = decimal.Decimal('1.000000')
> >>> neg_one = decimal.Decimal('-1.000000')
> >>> pa.array([one], pa.decimal128(24, 12))
> <pyarrow.lib.Decimal128Array object at 0x7f7f5ae85cb0>
> [
> Decimal('1.000000000000')
> ]
> >>> pa.array([neg_one], pa.decimal128(24, 12))
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "array.pxi", line 181, in pyarrow.lib.array
> File "array.pxi", line 36, in pyarrow.lib._sequence_to_array
> File "error.pxi", line 77, in pyarrow.lib.check_status
> pyarrow.lib.ArrowInvalid: Rescaling decimal value -1000000.000000 from original scale of 6 to new scale of 12 would cause data loss
> >>> pa.__version__
> '0.9.0'
> {code}
> not only is the error spurious, the decimal value has been multiplied by one million (i.e. 10 ** 6 and 6 is the difference in scales, but this is still pretty strange to me).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)