Repository navigation
[Server] Accept a capitalized boolean for the Iceberg dropTable's purgeRequested - #1890
Merged
yili-db merged 1 commit intoSep 21, 2026
Conversation
…geRequested
Armeria converts a Boolean query parameter through a fixed table of true|TRUE|1
and false|FALSE|0, so DELETE .../tables/{table}?purgeRequested=True was answered
400 "Can't convert 'True' to type 'Boolean'". True and False are what a Python
client sends: urlencode({"purgeRequested": True}) yields purgeRequested=True.
The Iceberg REST spec types the parameter as a boolean, so a capitalized spelling
is a valid request and dropping the table is the correct answer.
Bind the parameter as a String and validate it, reading true and false without
regard to case. The spellings Armeria already accepted, 1 and 0 included, keep
working, and a value that is not a boolean at all stays a 400 with a message that
names the offending value.
Signed-off-by: Noritaka Sekiyama <[email protected]>
Contributor
Author
|
Filed #1891 for the ten |
3 of 4 tasks
yili-db
approved these changes
Sep 21, 2026
newfront
pushed a commit
to newfront/unitycatalog
that referenced
this pull request
Sep 24, 2026
…geRequested (unitycatalog#1890) **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [x] 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! - [x] If you've added or modified a feature, documentation in `docs` is updated (nothing in `docs/` describes this parameter) **Description of changes** `pyiceberg` cannot drop an Iceberg table through Unity Catalog today. Both of its entry points fail with a 400: ``` >>> catalog.drop_table(("my_schema", "t")) # sends purgeRequested=False pyiceberg.exceptions.BadRequestError: BadRequestException: Can't convert 'False' to type 'Boolean'. >>> catalog.purge_table(("my_schema", "t")) # sends purgeRequested=True pyiceberg.exceptions.BadRequestError: BadRequestException: Can't convert 'True' to type 'Boolean'. ``` pyiceberg hands a Python `bool` straight to `requests` (`params={"purgeRequested": purge_requested}` in `pyiceberg/catalog/rest/__init__.py`), and `requests` renders it `True` / `False`. Armeria converts a `Boolean` parameter through a fixed table of `true|TRUE|1` and `false|FALSE|0` (`StringUtil.stringToBoolean`), so neither spelling converts, and `AnnotatedValueResolver` is in an `internal` package, so the conversion is not pluggable. The Iceberg REST spec types this parameter `boolean` with `default: false`, so a capitalized spelling is a valid request and dropping the table is the correct answer. This is the second of the two interop checks unitycatalog#1696 named as open when the native Iceberg write endpoints landed; the first (HEAD stalling) was fixed in unitycatalog#1801. **Technical changes** - `IcebergRestCatalogService.dropTable` binds `purgeRequested` as a `String` and validates it, reading `true` and `false` without regard to case. - The spellings Armeria already accepted, `1` and `0` included, keep working, so the accepted set only grows. A value that is not a boolean at all is still a 400, now with a message that names the offending value (`Invalid purgeRequested: yes. It must be true or false.`) instead of Armeria's `Can't convert 'yes' to type 'Boolean'.` - The value itself stays unused: purging is not implemented, and `dropTable` removes the table either way, as before. **Two choices worth a reviewer's opinion** - The helper validates rather than parses. Returning an `Optional<Boolean>` no caller reads would be new surface with nothing behind it, so the value is dropped after the check; when purge is implemented this becomes a parse. - Only the Iceberg endpoint is fixed here. Ten `Optional<Boolean>` query parameters on the native surface (`force` on the catalog, schema, function, model, credential and external-location deletes, plus `include_browse`, `omit_properties`, `omit_columns`) reject `True` the same way -- measured on a local server. That is the native API's own contract rather than an Iceberg interop bug, and this repo's generated Python client is unaffected because it lowercases booleans, so I left it out and will file it separately. **Tests** - `testDropTableAcceptsCapitalizedPurgeRequested` walks `true, false, True, False, TRUE, FALSE, tRuE, 1, 0` and the empty value against a fresh table each, and asserts the table is gone afterwards. - `testDropTableRejectsNonBooleanPurgeRequested` asserts `yes`, `purge` and `2` are a 400 with the exact message **and that the table is still there** -- a destructive endpoint must not act on input it refused. Verified both directions: with the service file from `main` both new tests fail (`expected: 204 but was: 400` for `True`, and Armeria's message for `yes`); with the change all 19 tests in the class pass. ``` sbt "server/testOnly io.unitycatalog.server.service.IcebergRestCatalogTest" ``` End-to-end against a local server with pyiceberg 0.12.0: `drop_table` and `purge_table` both fail with the 400 above on `main` and both succeed on this branch, with the table gone from `list_tables` afterwards. **Backward compatibility**: the set of accepted values grows and nothing that worked stops working. The only change for an existing caller is the message text on a non-boolean value (same 400). Signed-off-by: Noritaka Sekiyama <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
docsis updated (nothing indocs/describes this parameter)Description of changes
pyicebergcannot drop an Iceberg table through Unity Catalog today. Both of its entry points fail with a 400:pyiceberg hands a Python
boolstraight torequests(params={"purgeRequested": purge_requested}inpyiceberg/catalog/rest/__init__.py), andrequestsrenders itTrue/False. Armeria converts aBooleanparameter through a fixed table oftrue|TRUE|1andfalse|FALSE|0(StringUtil.stringToBoolean), so neither spelling converts, andAnnotatedValueResolveris in aninternalpackage, so the conversion is not pluggable. The Iceberg REST spec types this parameterbooleanwithdefault: false, so a capitalized spelling is a valid request and dropping the table is the correct answer.This is the second of the two interop checks #1696 named as open when the native Iceberg write endpoints landed; the first (HEAD stalling) was fixed in #1801.
Technical changes
IcebergRestCatalogService.dropTablebindspurgeRequestedas aStringand validates it, readingtrueandfalsewithout regard to case.1and0included, keep working, so the accepted set only grows. A value that is not a boolean at all is still a 400, now with a message that names the offending value (Invalid purgeRequested: yes. It must be true or false.) instead of Armeria'sCan't convert 'yes' to type 'Boolean'.dropTableremoves the table either way, as before.Two choices worth a reviewer's opinion
Optional<Boolean>no caller reads would be new surface with nothing behind it, so the value is dropped after the check; when purge is implemented this becomes a parse.Optional<Boolean>query parameters on the native surface (forceon the catalog, schema, function, model, credential and external-location deletes, plusinclude_browse,omit_properties,omit_columns) rejectTruethe same way -- measured on a local server. That is the native API's own contract rather than an Iceberg interop bug, and this repo's generated Python client is unaffected because it lowercases booleans, so I left it out and will file it separately.Tests
testDropTableAcceptsCapitalizedPurgeRequestedwalkstrue, false, True, False, TRUE, FALSE, tRuE, 1, 0and the empty value against a fresh table each, and asserts the table is gone afterwards.testDropTableRejectsNonBooleanPurgeRequestedassertsyes,purgeand2are a 400 with the exact message and that the table is still there -- a destructive endpoint must not act on input it refused.Verified both directions: with the service file from
mainboth new tests fail (expected: 204 but was: 400forTrue, and Armeria's message foryes); with the change all 19 tests in the class pass.End-to-end against a local server with pyiceberg 0.12.0:
drop_tableandpurge_tableboth fail with the 400 above onmainand both succeed on this branch, with the table gone fromlist_tablesafterwards.Backward compatibility: the set of accepted values grows and nothing that worked stops working. The only change for an existing caller is the message text on a non-boolean value (same 400).