Repository navigation
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
A server that serializes unset fields as
nullmakes the table and view create/load/register responses fail with a pydantic validation error, becauseTableResponse.config,TableResponse.storage_credentialsandViewResponse.configonly default when the key is absent.ConfigResponsehas the same problem fordefaultsandoverrides:RestCatalograisesAttributeError: 'NoneType' object has no attribute 'update'while fetching the config on construction.Java reads a null value as absent:
LoadTableResponseParseruseshasNonNullforconfigandstorage-credentials,ConfigResponseParserdoes the same fordefaults/overrides, andLoadViewResponseParserwas aligned in apache/iceberg#17250. This adds the same before-validators thatNamespaceResponse.propertiesalready has, sonullreads 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_overridesandtest_catalog_with_null_config_defaults_and_overridesin 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.