iceberg-python icon indicating copy to clipboard operation
iceberg-python copied to clipboard

Better error messages when creating a table with unsupported types

Open vtk9 opened this issue 1 year ago • 3 comments

Feature Request / Improvement

Related to https://github.com/apache/iceberg-python/issues/830 (reproducer included)

Creating a iceberg table using an arrow table that contains an unsupported type (such as date64). The resultant message is TypeError: Unsupported type: date64[ms]

It would be great if this error message also printed out the column name that has this unsupported type.

Even better, instead of raising a TypeError can a more specific error be returned (such as UnsupportedPyArrowType) which includes the pyarrow.Field (column_name, column_type) as an attribute so that this error can be caught and different exception re-raised based on information contained inside UnsupportedPyArrowType

For example, something like

try:
   ...
except UnsupportedPyArrowType as e:
   raise NewException(f"failure due to {e.field.name}")

vtk9 avatar Jun 26 '24 16:06 vtk9

Heres the relevant code

https://github.com/apache/iceberg-python/blob/a6cd0cf325b87b360077bad1d79262611ea64424/pyiceberg/io/pyarrow.py#L932

kevinjqliu avatar Jun 26 '24 18:06 kevinjqliu

I want to work on this issue, but I cannot find a contributing-doc in the repo on how to set-up the project and run tests.

@kevinjqliu

vivek378521 avatar Jul 01 '24 10:07 vivek378521

@vivek378521 The docs are located here.

https://py.iceberg.apache.org/contributing/ https://github.com/apache/iceberg-python/blob/main/mkdocs/docs/contributing.md

kevinjqliu avatar Jul 01 '24 15:07 kevinjqliu

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Dec 29 '24 00:12 github-actions[bot]

Hi @kevinjqliu, I'm not sure if this issue is being worked on, in case not, can you assign it to me? :)

DevChrisCross avatar Jan 04 '25 10:01 DevChrisCross

@DevChrisCross assigned to you!

kevinjqliu avatar Jan 04 '25 18:01 kevinjqliu

@kevinjqliu @Fokko could you kindly check the PR please? Thank you! :)

DevChrisCross avatar Jan 08 '25 07:01 DevChrisCross