Skip to content

[Server] Implement the Iceberg updateNamespaceProperties endpoint - #1848

Merged
yili-db merged 3 commits into
unitycatalog:mainfrom
moomindani:feat/iceberg-update-namespace-properties
Sep 11, 2026
Merged

yili-db merged 3 commits into
unitycatalog:mainfrom
moomindani:feat/iceberg-update-namespace-properties

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.

POST on a namespace's properties had no route, so an engine's ALTER NAMESPACE ... SET PROPERTIES was
answered with a 405 before any service was reached. Unity Catalog has kept schema properties all along;
the endpoint that patches them was missing from the Iceberg REST surface.

This serves it and advertises V1_UPDATE_NAMESPACE with the other write endpoints. The response
reports which keys were updated, which were removed, and which were asked to be removed but were
not there, as the spec describes.

Two things worth a reviewer's attention:

  • The patch is applied by a new SchemaRepository method rather than through updateSchema.
    updateSchema replaces the whole property map and reads an empty one as "nothing to do", so
    removing a schema's last property could not be expressed through it; and the patch has to read and
    write in one transaction, so two callers changing different keys do not lose each other's change.
  • A key named in both updates and removals is refused by Iceberg's own request validation, which
    raises UnprocessableEntityException. The spec answers that with 422, a status the shared
    ErrorCode enum had no entry for, so this adds one; the Delta API has no 422, so that dialect keeps
    reporting such a request as a bad one, which the enum already expresses with its per-dialect status.
    Say so if you would rather this answered 400 and left ErrorCode alone.

For users: namespace properties can be set and removed from any Iceberg client, and the response says
exactly what the catalog did.

testUpdateNamespaceProperties pins the three reported sets, that keys not mentioned are left alone,
the 422, and the 404 for a namespace that is not there. It fails on an unfixed tree and passes with the
fix; the full server/test suite shows no failure attributable to this change.

assertThat(updated.removed()).containsExactly("drop");
assertThat(updated.missing()).containsExactly("absent");

// The namespace itself reflects the patch: keys not mentioned are left alone.

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.

After this one, please also try to remove all properties and make sure no property is left for this schema.
The reason being that some future change might "optimize" setting empty property to not changing property at all.

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.

Good catch, and it is not hypothetical: updateSchema is already that shortcut -- it only touches properties when the map it is given is non-empty -- which is exactly why this endpoint patches through applyPropertyChanges instead of it.

The test now removes every remaining key and asserts the namespace reports no properties at all. Reading the namespace back moved into a small helper, since two assertions want it.

@yili-db yili-db left a comment

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 rebase

POST on a namespace's properties was not implemented, so an engine's ALTER NAMESPACE ... SET
PROPERTIES against this catalog was answered by Armeria before any service was reached, with a 405
saying the path takes no such method. Unity Catalog has kept schema properties all along; the endpoint
that patches them was only missing from the Iceberg REST surface.

Serve it, and advertise V1_UPDATE_NAMESPACE with the other write endpoints. The response reports which
keys were set, which were removed, and which were asked to be removed but were not there, as the spec
describes.

The patch is applied by a new SchemaRepository method rather than through updateSchema, for two
reasons: updateSchema replaces the whole property map, and it reads an empty map as "nothing to do",
so removing a schema's last property could not be expressed; and the patch has to read and write in
one transaction, so that two callers changing different keys do not lose each other's change.

A key named in both updates and removals is refused by Iceberg's own request validation, which raises
UnprocessableEntityException. The spec answers that with 422, a status the shared ErrorCode enum had no
entry for, so this adds one. The Delta API has no 422, so that dialect keeps reporting such a request
as a bad one.

Signed-off-by: Noritaka Sekiyama <[email protected]>
Review follow-up. The test now removes every remaining key and asserts the
namespace reports no properties at all, which is the case a later "an empty
property set means nothing to write" shortcut would get wrong. updateSchema is
already that shortcut -- it only touches properties when the map it is given is
non-empty -- which is why this endpoint patches through applyPropertyChanges
instead, so the case is worth holding down.

Reading the namespace back moves into a named helper, since two assertions now
want it.

Signed-off-by: Noritaka Sekiyama <[email protected]>
@moomindani
moomindani force-pushed the feat/iceberg-update-namespace-properties branch from ed6b934 to feb0d47 Compare September 10, 2026 00:54
@moomindani

Copy link
Copy Markdown
Contributor Author

Rebased onto 4ee2b248.

Resolve conflicts from the Iceberg error-types rework that landed on `main`:

- `IcebergRestExceptionHandler`
  - Union the new Iceberg exception imports from both sides.
  - Add a `UNPROCESSABLE_ENTITY -> UnprocessableEntityException` arm to the now-exhaustive `icebergExceptionFor` switch, without which the new `ErrorCode` constant fails to compile.
- `IcebergRestCatalogTest`
  - Keep both sides' additions: `testUpdateNamespaceProperties` and its `namespaceProperties` helper alongside `testLoadTableSnapshotsParameter` and the new `assertErrorType`/`renameRequest`/`loadedSnapshotIds` helpers.

`server/testOnly IcebergRestCatalogTest` passes (13 tests).

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Isaac <[email protected]>
@yili-db
yili-db merged commit c743567 into unitycatalog:main Sep 11, 2026
16 checks passed
@moomindani

Copy link
Copy Markdown
Contributor Author

Thanks for resolving this yourself -- I had the same rebase ready locally (same UNPROCESSABLE_ENTITY arm, same test resolution) and dropped it in favour of your merge. Happy to take the rebase on the remaining ones so it does not land on you.

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