Skip to content

Treat the exists namespace property as reserved in SqlCatalog - #4531

Open
gedaliakliger wants to merge 1 commit into
apache:mainfrom
gedaliakliger:fix/4525-sql-reserved-exists-property
Open

gedaliakliger wants to merge 1 commit into
apache:mainfrom
gedaliakliger:fix/4525-sql-reserved-exists-property

Conversation

@gedaliakliger

Copy link
Copy Markdown
Contributor

Closes #4525

Rationale for this change

SqlCatalog now handles the exists namespace property the way Java's JdbcCatalog does:

  • create_namespace always stores exists=true next to the given properties (JdbcCatalog.createNamespace).
  • load_namespace_properties no longer returns it (JdbcCatalog.loadNamespaceMetadata).
  • update_namespace_properties raises ValueError("Cannot set reserved property: exists") when updates contains it (JdbcCatalog.setProperties). create_namespace raises the same error; Java fails there too, because buildOrThrow rejects the duplicate key.

Two deviations from Java:

  • A removal of exists is skipped and reported under missing. JdbcCatalog.removeProperties has no guard and would delete the row. Since the property is hidden from load_namespace_properties, deleting it would contradict the returned summary.
  • The re-insert from Keep a SQL catalog namespace after removing its last property #4503 stays, for namespaces that released versions created with properties and therefore without the marker. It now checks whether any row remains instead of whether any visible property remains.

Are these changes tested?

Yes. test_namespace_rejects_reserved_exists_property and test_namespace_created_with_properties_survives_external_property_removal are new, and test_load_empty_namespace_properties and test_update_namespace_properties_removes_all_properties now expect {}. The four fail on main (28 cases) and pass with this change.

Ran locally: pytest tests/catalog/test_catalog_behaviors.py tests/catalog/test_sql.py tests/catalog/test_base.py tests/cli -m unit (971 passed), and ruff, ruff-format and mypy on the changed files. The full suite and the integration tests are left to CI.

Are there any user-facing changes?

Yes, for the release notes:

  • load_namespace_properties on a SqlCatalog or InMemoryCatalog no longer returns exists. A namespace created without properties returns {} instead of {"exists": "true"}.
  • create_namespace and update_namespace_properties raise ValueError when given exists as a property key.

Always store the exists marker in create_namespace, hide it from
load_namespace_properties and reject it in update_namespace_properties,
as Java's JdbcCatalog does.

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.

SqlCatalog: Treat the exists namespace property as reserved, like Java's JdbcCatalog

1 participant