raulcd commented on issue #46138:
URL: https://github.com/apache/arrow/issues/46138#issuecomment-2804288078

   I think there is an issue with how `CastOptions` interact between 
table/compute on the `cast` function. I don't have much experience with how 
this should work and can't spend much to investigate internally, it has to do 
with how Table/Column(aka RecordBatch)/compute interact with the cast function, 
basically table uses:
   
https://github.com/apache/arrow/blob/b603ea5b27092dc870701baade7cdd50462a3e09/python/pyarrow/table.pxi#L4721-L4725
   `field.type` will always have a value and options (on this case) too but 
then we check that either field and safe or options have to be populated:
   
https://github.com/apache/arrow/blob/b603ea5b27092dc870701baade7cdd50462a3e09/python/pyarrow/_compute.pyx#L2775-L2779
   so from what I can see, for table.cast if we add `CastOptions` this will 
fail.
   
   If someone can investigate a little more that would be awesome.
   
   As per your specific example you can do (without using `CastOptions` but 
that's still not solving the issue with the interaction of `CastOptions` on 
`table.cast()`:
   ```
   >>> table.cast(new_schema, safe=False)
   pyarrow.Table
   timestamp: timestamp[us, tz=UTC]
   ----
   timestamp: [[2023-03-15 15:15:00.123456Z]]
   ```


-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to