danielcweeks commented on code in PR #17642:
URL: https://github.com/apache/iceberg/pull/17642#discussion_r4553699040
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -1091,6 +1091,10 @@ paths:
Load a table from the catalog.
+ Servers MUST NOT return format version 4 tables from this endpoint.
+ A request to load a format version 4 table fails with a 400
`UnsupportedTableFormatVersionException`; clients should load it through the
`/v2` endpoint instead.
Review Comment:
```suggestion
Servers MUST NOT return format version 4 tables from this endpoint.
A request to load a format version 4 table fails with a 400
`UnsupportedTableFormatVersionException`; clients must load v4 tables through
the `/v2` endpoint.
```
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -1091,6 +1091,10 @@ paths:
Load a table from the catalog.
+ Servers MUST NOT return format version 4 tables from this endpoint.
+ A request to load a format version 4 table fails with a 400
`UnsupportedTableFormatVersionException`; clients should load it through the
`/v2` endpoint instead.
Review Comment:
I think `422` is more accurate as a return code. This is not a malformed
request, but a semantically incorrect request.
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -6344,6 +6479,16 @@ components:
}
}
+ UnsupportedTableFormatVersionError:
+ summary: The table's format version is not served by this endpoint
+ value: {
+ "error": {
+ "message": "The given table's format version is not supported by
this endpoint",
Review Comment:
nit: this message doesn't tell the user what to do. Can we follow the usual
"Cannot X because Y" form and include the remedy? For example: "Cannot load
format version 4 table through /v1: use the /v2 loadTable endpoint".
<!-- lenses: russell-review -->
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -1145,7 +1130,15 @@ paths:
Not Modified - Based on the content of the 'If-None-Match' header
the table metadata has
not changed since.
400:
- $ref: '#/components/responses/BadRequestErrorResponse'
+ description:
+ Bad Request - The request is malformed, or the table is at a
format version that this endpoint does not serve.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/IcebergErrorResponse'
+ examples:
+ UnsupportedTableFormatVersion:
+ $ref:
'#/components/examples/UnsupportedTableFormatVersionError'
Review Comment:
Similar to above, I think `422` is probably more accurate.
<!-- lenses: weeks-review -->
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -1145,7 +1130,15 @@ paths:
Not Modified - Based on the content of the 'If-None-Match' header
the table metadata has
not changed since.
400:
- $ref: '#/components/responses/BadRequestErrorResponse'
+ description:
+ Bad Request - The request is malformed, or the table is at a
format version that this endpoint does not serve.
Review Comment:
`400` is malformed content and format version doesn't fit that (`422`
instead)
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -2286,6 +2331,31 @@ components:
schema:
type: string
+ if-none-match:
+ name: If-None-Match
+ in: header
+ description:
+ An optional header that allows the server to return 304 (Not Modified)
if the metadata
+ is current. The content is the value of the ETag received in a
CreateTableResponse,
+ LoadTableResponse or CommitTableResponse.
+ required: false
+ schema:
+ type: string
+
+ snapshots:
+ name: snapshots
+ in: query
+ description:
+ The snapshots to return in the body of the metadata via the
`snapshots` field. Setting
+ the value to `all` would return the full set of snapshots currently
valid for the table.
+ Setting the value to `refs` would load all snapshots referenced by
branches or tags.
+
+ Default if no param is provided is `all`.
Review Comment:
We might want to move the default wording to the individual endpoints since
there's some interest in making `v2` use `refs` by default.
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -3122,11 +3208,16 @@ components:
format-version:
type: integer
minimum: 1
- maximum: 3
+ maximum: 4
table-uuid:
type: string
location:
type: string
+ description:
+ The table's base location.
+ Required through format version 3, where it may be a path without
a URI scheme; readers prepend a scheme for consistency with v4 absolute paths.
Review Comment:
I believe even v3 required a scheme, please double check with table spec, so
we aren't duplicating (and possibly making unnecessary statements).
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -1361,6 +1354,58 @@ paths:
5XX:
$ref: '#/components/responses/ServerErrorResponse'
+ /v2/{prefix}/namespaces/{namespace}/tables/{table}:
+ parameters:
+ - $ref: '#/components/parameters/prefix'
+ - $ref: '#/components/parameters/namespace'
+ - $ref: '#/components/parameters/table'
+
+ get:
+ tags:
+ - Catalog API
+ summary: Load a table from the catalog
+ operationId: loadTableV2
+ description:
+ Load a table from the catalog.
+
+
+ Behaves exactly like the v1 `loadTable` endpoint, except that it may
also return format version 4 tables.
+ Clients that support format version 4 should load tables through this
endpoint.
Review Comment:
I think we need to clean up this description. We plan on changing the
behavior from `v1` (e.g. read restrictions must be handled if seen), so saying
it's just like `v1` is not accurate.
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -4270,13 +4361,44 @@ components:
items:
$ref: '#/components/schemas/FieldLabels'
+ TableLocation:
+ type: string
+ description:
+ The table's base location, used to resolve relative paths in metadata.
+ Must be an absolute path with a URI scheme when present, and must be
present when the returned metadata contains relative paths and omits
`location`, because the metadata cannot be resolved otherwise.
Review Comment:
nit: I don't think presence rules belong on a string schema. Whether the
field is present depends on the response that contains it, and "must be present
when..." is already in the `LoadTableResult` description, so now the rule is
stated twice and the copies can drift. Can we limit this to what the value is
("The table's base location, used to resolve relative paths in metadata. Must
be an absolute location with a URI scheme.") and keep the presence and
precedence rules in the containing response descriptions?
<!-- lenses: weeks-review, blue-review -->
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -2286,6 +2331,31 @@ components:
schema:
type: string
+ if-none-match:
+ name: If-None-Match
+ in: header
+ description:
+ An optional header that allows the server to return 304 (Not Modified)
if the metadata
+ is current. The content is the value of the ETag received in a
CreateTableResponse,
+ LoadTableResponse or CommitTableResponse.
Review Comment:
```suggestion
is current.
```
We're reusing this component, so we shouldn't duplicate where it's valid
here in the description.
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -3036,7 +3115,14 @@ components:
format: int64
manifest-list:
type: string
- description: Location of the snapshot's manifest list file
+ description:
+ Location of the snapshot's manifest list file.
+ Used for format versions 1-3 and must be absent for format version
4, which uses `root-manifest` instead.
Review Comment:
This is not an accurate statement since `v4` tables can reference older
snapshots.
##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -3036,7 +3115,14 @@ components:
format: int64
manifest-list:
type: string
- description: Location of the snapshot's manifest list file
+ description:
+ Location of the snapshot's manifest list file.
+ Used for format versions 1-3 and must be absent for format version
4, which uses `root-manifest` instead.
+ root-manifest:
+ type: string
+ description:
+ Location of the snapshot's root manifest.
+ Required for format version 4 and must be absent for format
versions 1-3.
Review Comment:
Same here, statement is inaccurate since `v4` tables can still reference
older manifests.
--
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]