-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified exception objects being thrown when converting Pyarrow tables #1498
base: main
Are you sure you want to change the base?
Changes from all commits
f1b8f50
cce35c7
217e142
e7736ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
from pytest_mock.plugin import MockerFixture | ||
|
||
from pyiceberg.catalog import Catalog | ||
from pyiceberg.exceptions import NoSuchTableError | ||
from pyiceberg.exceptions import NoSuchTableError, UnsupportedPyArrowTypeException | ||
from pyiceberg.io import FileIO | ||
from pyiceberg.io.pyarrow import _pyarrow_schema_ensure_large_types | ||
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionField, PartitionSpec | ||
|
@@ -616,13 +616,18 @@ def test_add_files_with_timestamp_tz_ns_fails(session_catalog: Catalog, format_v | |
|
||
# add the parquet files as data files | ||
with pytest.raises( | ||
TypeError, | ||
match=re.escape( | ||
"Iceberg does not yet support 'ns' timestamp precision. Use 'downcast-ns-timestamp-to-us-on-write' configuration property to automatically downcast 'ns' to 'us' on write." | ||
), | ||
): | ||
UnsupportedPyArrowTypeException, | ||
match=re.escape("Column 'quux' has an unsupported type: timestamp[ns, tz=UTC]"), | ||
) as exc_info: | ||
tbl.add_files(file_paths=[file_path]) | ||
|
||
exception_cause = exc_info.value.__cause__ | ||
assert isinstance(exception_cause, TypeError) | ||
assert ( | ||
"Iceberg does not yet support 'ns' timestamp precision. Use 'downcast-ns-timestamp-to-us-on-write' configuration property to automatically downcast 'ns' to 'us' on write." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this part of the error message? if so, can we add it to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is no longer part of the error message and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for this error, we actually want to propagate it upwards. We want to let the users know there is the Maybe we can try reraising the underlying error to preserve its message
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exception is still preserved and propagated still and can also be seen in the traceback once the error is raised, given the exception is raised
I think it's still sufficient enough for the user to know what's going on, let me know if you still think otherwise. :) |
||
in exception_cause.args[0] | ||
) | ||
|
||
|
||
@pytest.mark.integration | ||
@pytest.mark.parametrize("format_version", [1, 2]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, for those that use PyIceberg with just
s3fs
, this import will be problematic. We should move this intopyarrow.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I will move this into the
pyarrow.py
. :)