Repository navigation
Keep a SQL catalog namespace after removing its last property - #4503
Open
gedaliakliger wants to merge 1 commit into
Open
gedaliakliger wants to merge 1 commit into
gedaliakliger wants to merge 1 commit into
Conversation
A namespace without tables exists only through its rows in iceberg_namespace_properties, so update_namespace_properties with removals covering every property made the namespace disappear. Store the minimal `exists` property again when the last one is removed.
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
SqlCatalog.create_namespacewrites the reservedexistsproperty only when no user properties are supplied. Removing every property from such a namespace deleted its only row fromiceberg_namespace_properties, sonamespace_existsreturned false and the namespace vanished fromlist_namespaces. Java'sJdbcCatalog.createNamespacealways storesexists=truealongside user properties, andJdbcUtil.namespaceExistsrelies on those rows. When removals leave no properties, store the minimalexistsrow again.Are these changes tested?
test_update_namespace_properties_removes_all_propertiesintests/catalog/test_catalog_behaviors.pyremoves the only property and asserts the namespace still exists, is listed, and loads with{"exists": "true"}. It fails onmain(9 cases,assert Falseonnamespace_exists) and passes with this change (9 cases).Ran here:
.venv/bin/python -m pytest tests/catalog/test_catalog_behaviors.py -m unit -k update_namespace_properties_removes_all_properties -v,.venv/bin/prek run ruff ruff-format --files pyiceberg/catalog/sql.py tests/catalog/test_catalog_behaviors.py,.venv/bin/prek run mypy --files pyiceberg/catalog/sql.py tests/catalog/test_catalog_behaviors.py. CI runs the full suite.Are there any user-facing changes?
Yes. Removing all properties from a SQL catalog namespace no longer makes the namespace disappear; it stays listed and reports
{"exists": "true"}.