Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-4457

[Python] Cannot create Decimal128 array using integers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.11.0, 0.11.1, 0.12.0
    • 0.13.0
    • Python
    • Python: 2.7.15 and 3.7.2
      pyarrow: tested on 0.11.0, 0.11.1, 0.12.0

    Description

      There appears to have been a regression introduced in 0.11.0 such that we can no longer create a Decimal128 array using integers.

      To reproduce:

      import pyarrow
      column = pyarrow.decimal128(16, 4)
      array = pyarrow.array([1], column)
      

      Expected result: Behavior same as 0.10.0 and earlier; a Decimal128 array would be created with no problems.

      Actual result: an exception is thrown.

      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pyarrow/array.pxi", line 175, in pyarrow.lib.array
          return _sequence_to_array(obj, mask, size, type, pool, from_pandas)
        File "pyarrow/array.pxi", line 36, in pyarrow.lib._sequence_to_array
          check_status(ConvertPySequence(sequence, mask, options, &out))
        File "pyarrow/error.pxi", line 81, in pyarrow.lib.check_status
          raise ArrowInvalid(message)
      ArrowInvalid: Could not convert 1 with type int: converting to Decimal128
      Could not convert 1 with type int: converting to Decimal128
      

      The crash doesn't occur if we use a decimal.Decimal object instead.

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              yiannisliodakis Diego Argueta
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m