Repository navigation
Conversation
| assertThat(updated.removed()).containsExactly("drop"); | ||
| assertThat(updated.missing()).containsExactly("absent"); | ||
|
|
||
| // The namespace itself reflects the patch: keys not mentioned are left alone. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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]>
ed6b934 to
feb0d47
Compare
|
Rebased onto |
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]>
|
Thanks for resolving this yourself -- I had the same rebase ready locally (same |
PR Checklist
docsis updatedDescription of changes
Part of #1846.
POSTon a namespace's properties had no route, so an engine'sALTER NAMESPACE ... SET PROPERTIESwasanswered 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_NAMESPACEwith the other write endpoints. The responsereports which keys were
updated, which wereremoved, and which were asked to be removed but werenot there, as the spec describes.
Two things worth a reviewer's attention:
SchemaRepositorymethod rather than throughupdateSchema.updateSchemareplaces the whole property map and reads an empty one as "nothing to do", soremoving 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.
updatesandremovalsis refused by Iceberg's own request validation, whichraises
UnprocessableEntityException. The spec answers that with 422, a status the sharedErrorCodeenum had no entry for, so this adds one; the Delta API has no 422, so that dialect keepsreporting 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
ErrorCodealone.For users: namespace properties can be set and removed from any Iceberg client, and the response says
exactly what the catalog did.
testUpdateNamespacePropertiespins 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/testsuite shows no failure attributable to this change.