Skip to content

Reject dropping a SqlCatalog namespace that has child namespaces - #4469

Open
gedaliakliger wants to merge 1 commit into
apache:mainfrom
gedaliakliger:fix/sql-drop-namespace-with-children
Open

gedaliakliger wants to merge 1 commit into
apache:mainfrom
gedaliakliger:fix/sql-drop-namespace-with-children

Conversation

@gedaliakliger

Copy link
Copy Markdown
Contributor

Rationale for this change

SqlCatalog.drop_namespace only checks for tables. With namespaces a and a.b, drop_namespace("a") deletes the properties of a and returns, while a is still listed and still exists through its child. InMemoryCatalog inherits this.

Java's JdbcCatalog.dropNamespace throws NamespaceNotEmptyException when listNamespaces(namespace) is not empty. This change does the same and raises NamespaceNotEmptyError.

Are these changes tested?

Yes. test_drop_namespace_raises_error_when_namespace_has_child_namespaces fails on main (DID NOT RAISE NamespaceNotEmptyError) and passes with this change. Ran here: the namespace tests in tests/catalog/test_catalog_behaviors.py, tests/catalog/test_sql.py and tests/cli/test_console.py (258 passed), plus ruff, ruff-format and mypy on the changed files. The full suites are left to CI.

Are there any user-facing changes?

Yes. drop_namespace on SqlCatalog and InMemoryCatalog raises NamespaceNotEmptyError for a namespace that has child namespaces, instead of returning without dropping it.

drop_namespace only checked for tables, so dropping a parent namespace
deleted its properties and reported success while its children kept it
listed. Java's JdbcCatalog.dropNamespace throws NamespaceNotEmptyException
in this case.

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