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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to