arrow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ben w (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ARROW-2387) negative decimal values get spurious rescaling error
Date Tue, 03 Apr 2018 21:01:00 GMT
ben w created ARROW-2387:
----------------------------

             Summary: 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


{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 for some
reason.



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

Mime
View raw message