[ https://issues.apache.org/jira/browse/ARROW-12387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17322119#comment-17322119 ]
Taras Kuzyo edited comment on ARROW-12387 at 4/15/21, 11:52 AM: ---------------------------------------------------------------- [~jorisvandenbossche], Thank you! Apparently, I have overlooked the `safe=False` option. was (Author: ktaras): [~jorisvandenbossche], Thank you! Apparently, I have overlooked the `safe=True` option. > [C++][Python] cannot cast float64 array to int64 > ------------------------------------------------ > > Key: ARROW-12387 > URL: https://issues.apache.org/jira/browse/ARROW-12387 > Project: Apache Arrow > Issue Type: Bug > Components: C++, Python > Affects Versions: 3.0.0 > Reporter: Taras Kuzyo > Priority: Major > Fix For: 5.0.0 > > > > {code:java} > >>> 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 > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)