You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "davlee1972 (via GitHub)" <gi...@apache.org> on 2024/05/29 22:15:29 UTC
[I] RecordBatchReader cast() errors introduced in pyarrow 16 [arrow]
davlee1972 opened a new issue, #41884:
URL: https://github.com/apache/arrow/issues/41884
### Describe the bug, including details regarding any error messages, version, and platform.
RecordBatchReader.cast() was added in pyarrow 16..
Error: pyarrow.lib.ArrowTypeError: Field 0 cannot be cast from date32[day] to date32[day]
```
>>> import pyarrow as pa
>>> import datetime
>>>
>>> t = pa.Table.from_pylist([{"abc": datetime.date.today()}])
>>> tb = t.to_reader()
>>> tb.cast(t.schema)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyarrow\\ipc.pxi", line 800, in pyarrow.lib.RecordBatchReader.cast
File "pyarrow\\error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow\\error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Field 0 cannot be cast from date32[day] to date32[day]
```
In my use case:
I'm trying to cast the results of a database query from:
Field 0 is a string, Field 1 is a date32[day], Field 2 is a **double**
to
Field 0 is a string, Field 1 is a date32[day], Field 2 is a **float**
But I'm getting Field 1 cast error on dates..
### Component(s)
Python
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Python] RecordBatchReader cast() errors introduced in pyarrow 16 [arrow]
Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche closed issue #41884: [Python] RecordBatchReader cast() errors introduced in pyarrow 16
URL: https://github.com/apache/arrow/issues/41884
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Python] RecordBatchReader cast() errors introduced in pyarrow 16 [arrow]
Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on issue #41884:
URL: https://github.com/apache/arrow/issues/41884#issuecomment-2160289667
@davlee1972 thanks for the report! It seems the cast from date32 to date32 is not explicitly included in the table of cast kernels, and therefore the `CanCast` fails.
Working on a fix in https://github.com/apache/arrow/pull/42098
--
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
Re: [I] [Python] RecordBatchReader cast() errors introduced in pyarrow 16 [arrow]
Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on issue #41884:
URL: https://github.com/apache/arrow/issues/41884#issuecomment-2176478355
Issue resolved by pull request 42098
https://github.com/apache/arrow/pull/42098
--
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