-
Notifications
You must be signed in to change notification settings - Fork 412
Fix and refactor error handling in rest catalog #2404
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
base: main
Are you sure you want to change the base?
Conversation
|
more of a meta question but I wonder if we could auto generate some testing based off of the openapi spec upstream? |
geruh
left a comment
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.
Overall, this looks good to me!!
There is a lot of refactoring here, and it centralizes all of the error handling into one place, which makes it easier to add new exceptions as they come from upstream. As we can see with this ViewAlreadyExistsError you added.
If there isn't a good way to test with the current rest catalog tests, maybe it would be good to add some additional unit tests. For example, NamespaceNotEmpty is properly handled instead of throwing a BadRequestError Or same for like the table and namespace already exists handling.
WDYT
| assert "Table does not exist" in str(e.value) | ||
|
|
||
|
|
||
| def test_load_table_404_non_existent_namespace(rest_mock: Mocker) -> None: |
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.
The mocked tests predate the time when we didn't have the IcebergTestFixtures Docker image. I think it would be best to test against the Docker image instead in the integration tests.
|
Thanks @gabeiglio for working on this, and thanks @geruh for bringing this back up in my mailbox :) I agree with what Drew is saying, but in general, I think this is a great improvement 👍 Could you follow up, so we can get this in? |
b922e1f to
acfafb5
Compare
geruh
left a comment
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.
This looks good to me! Just have the one comment below
| ) | ||
|
|
||
| with pytest.raises(NoSuchNamespaceError) as e: | ||
| RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).drop_table(("fokko", "does_not_exists")) |
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.
lol
geruh
left a comment
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.
Awesome thanks for this @gabeiglio!
|
@Fokko bringing this back up to your mailbox :) |
Rationale for this change
Error handling differed with the Java implementation in the following:
NoSuchNamespaceErrorif the namespace does not exists (same as Java)ViewAlreadyExistsErrorfor completeness even though we don't support creating views atmAre these changes tested?
Added two unit tests for testing the exception thrown between NoSuchNamespaceError and NoSuchTableError
Are there any user-facing changes?
No