timothyw553 commented on code in PR #18782:
URL: https://github.com/apache/iceberg/pull/18782#discussion_r4719324383
##########
core/src/main/java/org/apache/iceberg/rest/ErrorHandlers.java:
##########
@@ -145,6 +146,11 @@ private static class TableErrorHandler extends
DefaultErrorHandler {
@Override
public void accept(ErrorResponse error) {
switch (error.code()) {
+ case 400:
Review Comment:
to my understanding the spec PR (#17642 at `6b27d63`) specifies HTTP 422 and
`UnsupportedTableFormatVersionException` (extending
`UnprocessableEntityException`), not 400 and
`UnsupportedFormatVersionException`. should we align `ErrorHandlers`,
`RESTCatalogAdapter`, and the exception class, check the status and type
directly in tests, and update the PR description?
```diff
- case 400:
- if
(UnsupportedFormatVersionException.class.getSimpleName().equals(error.type())) {
- throw new UnsupportedFormatVersionException("%s",
error.message());
+ case 422:
+ if
(UnsupportedTableFormatVersionException.class.getSimpleName().equals(error.type()))
{
+ throw new UnsupportedTableFormatVersionException("%s",
error.message());
}
```
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -796,6 +808,7 @@ public Table registerTable(
response.tableMetadata(),
endpoints,
Map.of());
+ ops.useLoadPath(paths.table(ident), loadTablePath(ident));
Review Comment:
removing `useLoadPath` here in `registerTable` or in `replaceTransaction`
below still leaves the existing tests passing. could we add tests that register
a v4 table and refresh it, and replace a v4 table through a transaction and
commit?
##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -520,6 +523,19 @@ public static void tableExists(Catalog catalog,
TableIdentifier ident) {
public static LoadTableResponse loadTable(
Catalog catalog, TableIdentifier ident, SnapshotMode mode) {
+ LoadTableResponse response = loadTableV2(catalog, ident, mode);
+ int formatVersion = response.tableMetadata().formatVersion();
+ if (formatVersion >= MIN_FORMAT_VERSION_V2_LOAD_ONLY) {
+ throw new UnsupportedFormatVersionException(
Review Comment:
when the server doesn't advertise `V1_TABLE_EXISTS`, `tableExists` falls
back to loading the table, so won't this exception escape instead of returning
`true` for a v4 table? should we catch this specific exception in the
`tableExists` fallback to return `true` and add tests for no endpoint list and
v1 without HEAD?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]