Skip to content

[Server] Implement the Iceberg dropNamespace endpoint - #1847

Merged
yili-db merged 2 commits into
unitycatalog:mainfrom
moomindani:feat/iceberg-drop-namespace
Sep 9, 2026
Merged

yili-db merged 2 commits into
unitycatalog:mainfrom
moomindani:feat/iceberg-drop-namespace

Conversation

@moomindani

Copy link
Copy Markdown
Contributor

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Part of #1846.

DELETE on a namespace had no route, so an engine's DROP NAMESPACE was answered by Armeria before
any service was reached, with a 405 saying the path takes no such method. Unity Catalog has dropped
schemas all along, through SchemaRepository.deleteSchema; the operation was only missing from the
Iceberg REST surface.

This serves it and advertises V1_DELETE_NAMESPACE with the other write endpoints, so it is gated the
same way the other Iceberg writes are.

  • A namespace that still holds objects is refused. The repository reports that as a failed
    precondition, which would go out as 400; the spec answers a namespace that is not empty with 409, so
    it is raised as Iceberg's NamespaceNotEmptyException.
  • Authorizations of everything deleted are cleared exactly as SchemaService clears them, so dropping
    a namespace here leaves nothing behind that dropping it through the Unity Catalog API would remove.

For users: DROP NAMESPACE works from Spark, Trino and any other Iceberg client, and a namespace that
still has tables is refused with the status the client understands as "not empty".

testDropNamespace pins the 409 while a table is there, the 204 and empty body once it is not, the
404 for the namespace afterwards, and the updated endpoints list. It fails on an unfixed tree and
passes with the fix; the full server/test suite shows no failure attributable to this change.

DELETE on a namespace was not implemented, so an engine's DROP NAMESPACE against this catalog was
answered by Armeria before any service was reached: a 405 saying the path takes no such method. The
repository has done this work all along -- SchemaService deletes a schema through
SchemaRepository.deleteSchema -- it was only missing from the Iceberg REST surface.

Serve it, and advertise V1_DELETE_NAMESPACE with the other write endpoints. A namespace that still
holds objects is refused: the repository reports that as a failed precondition, which would go out as
400, and the REST spec answers a namespace that is not empty with 409, so it is raised as Iceberg's
NamespaceNotEmptyException. Authorizations of the deleted schema are cleared the same way
SchemaService clears them, so dropping a namespace here leaves nothing behind that dropping it through
the Unity Catalog API would have removed.

Signed-off-by: Noritaka Sekiyama <[email protected]>
}

@Test
public void testDropNamespace() throws Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fold this test into testNamespaces

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The cases are now a DropNamespace block in testNamespaces, after the get and list ones, reusing the catalog and schema that test already creates. Without the endpoint the block fails with 405 where 409 is expected, as the separate test did.

Review follow-up. The cases move into testNamespaces as a DropNamespace block
after the get and list ones, so a reader sees the namespace endpoints in the
order a client uses them and the block reuses the catalog and schema already
created there. Without the endpoint the block fails with 405 where 409 is
expected, as the separate test did.

Signed-off-by: Noritaka Sekiyama <[email protected]>
@yili-db
yili-db merged commit c34cf13 into unitycatalog:main Sep 9, 2026
16 checks passed
openinx pushed a commit that referenced this pull request Sep 9, 2026
…1860)

**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [ ] If there is a related issue, make sure it is linked to this PR.
- [x] If you've fixed a bug or added code that should be tested, add
tests!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

- #1847 added `@Delete(".../namespaces/{namespace}")`, so the 405
assertion in `testUnroutedIcebergRequestsAnswerWithAnIcebergError` now
hits a routed path
- Point it at `DELETE /namespaces` instead (collection serves GET/POST,
not DELETE)

Signed-off-by: Yi Li <[email protected]>
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.

2 participants