You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "0x26res (via GitHub)" <gi...@apache.org> on 2024/10/25 12:48:07 UTC

[I] Misleading error message when casting [arrow]

0x26res opened a new issue, #44534:
URL: https://github.com/apache/arrow/issues/44534

   ### Describe the enhancement requested
   
   This is really a minor issue. 
   
   The error message when casting a table with mismatching column name is misleading.
   
   ```python
   import pyarrow as pa
   
   
   pa.table({"col1": ["abc"]}).cast(
       pa.schema([("col1", pa.string()), ("col2", pa.string())])
   )
   ```
   
   Throws:
   ```
   ValueError: Target schema's field names are not matching the table's field names: ['col1'], ['col1', 'col2']
   ```
   
   You'd expect the first list of field names to be the "Target schema's field" and the second one to be the table's field name, given how it is worded.
   
   Alternatively if we want to keep the order, we can change the wording to "Table's field names are not matching the target schema's field names"
   
   The later mores sense to me because we are calling table.cast(schema), so the table comes first in the expression.
   
   It would need fixing in a few places. Happy to send an MR.
   
   https://github.com/apache/arrow/blob/802a84693b21847fc48efa2b29e23e0058256eeb/python/pyarrow/tests/test_table.py#L2109
   https://github.com/apache/arrow/blob/802a84693b21847fc48efa2b29e23e0058256eeb/python/pyarrow/ipc.pxi#L800
   https://github.com/apache/arrow/blob/802a84693b21847fc48efa2b29e23e0058256eeb/python/pyarrow/table.pxi#L3308
   
   
   
   
   ### 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] Misleading error message when casting [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #44534:
URL: https://github.com/apache/arrow/issues/44534#issuecomment-3547049504

   This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.


-- 
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