You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mroeschke (via GitHub)" <gi...@apache.org> on 2023/07/14 17:28:08 UTC

[GitHub] [arrow] mroeschke commented on pull request #35395: GH-35040: [Python] Pyarrow scalar cast should use compute kernel

mroeschke commented on PR #35395:
URL: https://github.com/apache/arrow/pull/35395#issuecomment-1636165320

   xref https://github.com/apache/arrow/issues/36677
   
   I don't think the new `safe` keyword fully covers past cases where numeric scalars could be cast to temporal scalars
   
   ```
   >>> import pyarrow as pa
   >>> pa.scalar(1.1).cast(pa.time32("s"))
   <pyarrow.Time32Scalar: datetime.time(0, 0, 1)>
   >>> pa.__version__
   '12.0.1'
   
   >>> import pyarrow as pa
   >>> pa.scalar(1.1).cast(pa.time32("s"), safe=False)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "pyarrow/scalar.pxi", line 91, in pyarrow.lib.Scalar.cast
     File "/opt/miniconda3/envs/pyarrow-pandas-dev/lib/python3.11/site-packages/pyarrow/compute.py", line 403, in cast
       return call_function("cast", [arr], options, memory_pool)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "pyarrow/_compute.pyx", line 572, in pyarrow._compute.call_function
     File "pyarrow/_compute.pyx", line 367, in pyarrow._compute.Function.call
     File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
     File "pyarrow/error.pxi", line 121, in pyarrow.lib.check_status
   pyarrow.lib.ArrowNotImplementedError: Unsupported cast from double to time32 using function cast_time32
   >>> pa.__version__
   '13.0.0.dev497'
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org