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

[C++][Python] cannot cast float64 array to int64

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.0.0
    • None
    • C++, Python
    • None

    Description

       

      >>> arr = [0.992133801741256, 0.993103448275862]
      >>> a = pa.scalar(arr[0], pa.float64())
      >>> pc.multiply(a, 1e8).cast(pa.int64())
      <pyarrow.Int64Scalar: 99213380>
      >>> b = pa.array(arr, pa.float64())
      >>> pc.multiply(b, 1e8).cast(pa.int64())
      Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "pyarrow/array.pxi", line 810, in pyarrow.lib.Array.cast
       File "/usr/local/lib/python3.6/dist-packages/pyarrow/compute.py", line 281, in cast
       return call_function("cast", [arr], options)
       File "pyarrow/_compute.pyx", line 465, in pyarrow._compute.call_function
       File "pyarrow/_compute.pyx", line 294, in pyarrow._compute.Function.call
       File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
       File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
      pyarrow.lib.ArrowInvalid: Float value 9.92134e+07 was truncated converting toint64
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ktaras Taras Kuzyo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: