nastra commented on code in PR #12259: URL: https://github.com/apache/iceberg/pull/12259#discussion_r1955661232
########## core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java: ########## @@ -1239,7 +1239,9 @@ public List<TableIdentifier> listViews(SessionContext context, Namespace namespa @Override public boolean viewExists(SessionContext context, TableIdentifier identifier) { - Endpoint.check(endpoints, Endpoint.V1_VIEW_EXISTS); + if (!endpoints.contains(Endpoint.V1_VIEW_EXISTS)) { + return false; Review Comment: I think we might actually need to fall back to loading the view as we did previously. Also btw the same issue applies for `namespaceExists` and `tableExists` as those three are all now doing a HEAD request. We might need something like ``` --- a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java +++ b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java @@ -444,12 +444,14 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog @Override public boolean tableExists(SessionContext context, TableIdentifier identifier) { - Endpoint.check(endpoints, Endpoint.V1_TABLE_EXISTS); - try { checkIdentifierIsValid(identifier); - client.head(paths.table(identifier), headers(context), ErrorHandlers.tableErrorHandler()); - return true; + if (endpoints.contains(Endpoint.V1_TABLE_EXISTS)) { + client.head(paths.table(identifier), headers(context), ErrorHandlers.tableErrorHandler()); + return true; + } else { + return super.tableExists(context, identifier); + } } catch (NoSuchTableException e) { return false; } @@ -665,13 +667,15 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog @Override public boolean namespaceExists(SessionContext context, Namespace namespace) { - Endpoint.check(endpoints, Endpoint.V1_NAMESPACE_EXISTS); - try { checkNamespaceIsValid(namespace); - client.head( - paths.namespace(namespace), headers(context), ErrorHandlers.namespaceErrorHandler()); - return true; + if (endpoints.contains(Endpoint.V1_NAMESPACE_EXISTS)) { + client.head( + paths.namespace(namespace), headers(context), ErrorHandlers.namespaceErrorHandler()); + return true; + } else { + return super.namespaceExists(context, namespace); + } } catch (NoSuchNamespaceException e) { return false; } @@ -1239,12 +1243,14 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog @Override public boolean viewExists(SessionContext context, TableIdentifier identifier) { - Endpoint.check(endpoints, Endpoint.V1_VIEW_EXISTS); - try { checkViewIdentifierIsValid(identifier); - client.head(paths.view(identifier), headers(context), ErrorHandlers.viewErrorHandler()); - return true; + if (endpoints.contains(Endpoint.V1_VIEW_EXISTS)) { + client.head(paths.view(identifier), headers(context), ErrorHandlers.viewErrorHandler()); + return true; + } else { + return super.viewExists(context, identifier); + } ``` -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org