Skip to content

REST: Read an explicit null config, storage-credentials, defaults or overrides as empty - #4353

Open
sohailshk wants to merge 1 commit into
apache:mainfrom
sohailshk:fix/rest-null-config
Open

sohailshk wants to merge 1 commit into
apache:mainfrom
sohailshk:fix/rest-null-config

Conversation

@sohailshk

Copy link
Copy Markdown
Contributor

Rationale for this change

A server that serializes unset fields as null makes the table and view create/load/register responses fail with a pydantic validation error, because TableResponse.config, TableResponse.storage_credentials and ViewResponse.config only default when the key is absent. ConfigResponse has the same problem for defaults and overrides: RestCatalog raises AttributeError: 'NoneType' object has no attribute 'update' while fetching the config on construction.

Java reads a null value as absent: LoadTableResponseParser uses hasNonNull for config and storage-credentials, ConfigResponseParser does the same for defaults/overrides, and LoadViewResponseParser was aligned in apache/iceberg#17250. This adds the same before-validators that NamespaceResponse.properties already has, so null reads as {} / [].

Not covered here: the scan planning models in scan_planning.py (null delete-files / file-scan-tasks / plan-tasks, which #17250 also fixed on the Java side), left as a follow-up.

Are these changes tested?

Yes: test_load_responses_with_null_config_and_storage_credentials, test_config_response_with_null_defaults_and_overrides and test_catalog_with_null_config_defaults_and_overrides in tests/catalog/test_rest.py (all fail on main, pass here). tests/catalog/test_rest.py and tests/catalog/test_rest_auth.py pass.

Are there any user-facing changes?

Tables and views can be loaded, and the catalog constructed, against REST servers that return explicit nulls for these fields.

…overrides as empty

A REST server that serializes unset fields as null made loading a table or view, or constructing the catalog, fail. Java reads a null config as empty.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant