Feature Request / Improvement
It looks like we just load the table and fail if it raises an exception:
|
default boolean tableExists(SessionContext context, TableIdentifier ident) { |
|
try { |
|
loadTable(context, ident); |
|
return true; |
|
} catch (NoSuchTableException e) { |
|
return false; |
|
} |
|
} |
Instead we would love to override this for the REST-Catalog, and use the HEAD call instead:
|
head: |
|
tags: |
|
- Catalog API |
|
summary: Check if a table exists |
|
operationId: tableExists |
|
description: |
|
Check if a table exists within a given namespace. The response does not contain a body. |
|
responses: |
|
204: |
|
description: Success, no content |
|
400: |
|
$ref: '#/components/responses/BadRequestErrorResponse' |
|
401: |
|
$ref: '#/components/responses/UnauthorizedResponse' |
|
403: |
|
$ref: '#/components/responses/ForbiddenResponse' |
|
404: |
|
description: |
|
Not Found - NoSuchTableException, Table not found |
|
content: |
|
application/json: |
|
schema: |
|
$ref: '#/components/schemas/IcebergErrorResponse' |
|
examples: |
|
TableToLoadDoesNotExist: |
|
$ref: '#/components/examples/NoSuchTableError' |
|
419: |
|
$ref: '#/components/responses/AuthenticationTimeoutResponse' |
|
503: |
|
$ref: '#/components/responses/ServiceUnavailableResponse' |
|
5XX: |
|
$ref: '#/components/responses/ServerErrorResponse' |
This will be more friendly on the catalog since it doesn't have to load the metadata, and will also return a faster response. We also use this when creating a view to double-check if there is not a table with the same name:
|
if (tableExists(context, identifier)) { |
The HEAD operation will be much faster than trying to load the table.
Query engine
None
Willingness to contribute
Feature Request / Improvement
It looks like we just load the table and fail if it raises an exception:
iceberg/api/src/main/java/org/apache/iceberg/catalog/SessionCatalog.java
Lines 180 to 187 in f2d6275
Instead we would love to override this for the REST-Catalog, and use the
HEADcall instead:iceberg/open-api/rest-catalog-open-api.yaml
Lines 833 to 864 in 97e034b
This will be more friendly on the catalog since it doesn't have to load the metadata, and will also return a faster response. We also use this when creating a view to double-check if there is not a table with the same name:
iceberg/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
Line 1303 in f2d6275
The HEAD operation will be much faster than trying to load the table.
Query engine
None
Willingness to contribute