okumin commented on code in PR #6425:
URL: https://github.com/apache/hive/pull/6425#discussion_r3079421026


##########
standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCatalogAdapter.java:
##########
@@ -514,68 +514,9 @@ <T extends RESTResponse> T execute(
           .withMessage(String.format("No route for request: %s %s", method, 
path));
     }
     ErrorResponse error = errorBuilder.build();
-    errorHandler.accept(error);
-    // if the error handler doesn't throw an exception, throw a generic one
-    throw new RESTException("Unhandled error: %s", error);
-  }
-
-  @Override
-  public <T extends RESTResponse> T delete(
-      String path,
-      Class<T> responseType,
-      Map<String, String> headers,
-      Consumer<ErrorResponse> errorHandler) {
-    return execute(HTTPMethod.DELETE, path, null, null, errorHandler);
-  }
-
-  @Override
-  public <T extends RESTResponse> T delete(
-      String path,
-      Map<String, String> queryParams,
-      Class<T> responseType,
-      Map<String, String> headers,
-      Consumer<ErrorResponse> errorHandler) {
-    return execute(HTTPMethod.DELETE, path, queryParams, null, errorHandler);
-  }
-
-  @Override
-  public <T extends RESTResponse> T post(
-      String path,
-      RESTRequest body,
-      Class<T> responseType,
-      Map<String, String> headers,
-      Consumer<ErrorResponse> errorHandler) {
-    return execute(HTTPMethod.POST, path, null, body, errorHandler);
-  }
-
-  @Override
-  public <T extends RESTResponse> T get(
-      String path,
-      Map<String, String> queryParams,
-      Class<T> responseType,
-      Map<String, String> headers,
-      Consumer<ErrorResponse> errorHandler) {
-    return execute(HTTPMethod.GET, path, queryParams, null, errorHandler);
-  }
-
-  @Override
-  public void head(String path, Map<String, String> headers, 
Consumer<ErrorResponse> errorHandler) {
-    execute(HTTPMethod.HEAD, path, null, headers, errorHandler);
-  }
-
-  @Override
-  public <T extends RESTResponse> T postForm(
-      String path,
-      Map<String, String> formData,
-      Class<T> responseType,
-      Map<String, String> headers,
-      Consumer<ErrorResponse> errorHandler) {
-    return execute(HTTPMethod.POST, path, null, formData, errorHandler);
-  }
-
-  @Override
-  public void close() {
-    // The caller is responsible for closing the underlying catalog backing 
this REST catalog.
+    response.setStatus(error.code());
+    RESTObjectMapper.mapper().writeValue(response.getWriter(), error);
+    return null;

Review Comment:
   `RESTServerCatalogAdapter` on apache/iceberg extends a `RESTClient`. I don't 
know the exact reason. The trick is used in [some integration 
tests](https://github.com/apache/iceberg/blob/apache-iceberg-1.10.1/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java#L289-L290).
   Anyway, as our adapter never behaves as a client, I removed the dependency 
on RESTClient. As a good side effect, this change ensures only a single path 
invokes `RESTServerCatalogAdapter#execute` and allows us to simplify the 
implementation.



-- 
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]

Reply via email to