amogh-jahagirdar commented on code in PR #14035:
URL: https://github.com/apache/iceberg/pull/14035#discussion_r2425145754


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -360,6 +360,13 @@ protected <T extends RESTResponse> T execute(
     }
   }
 
+  private <T extends RESTResponse> boolean emptyBody(
+      CloseableHttpResponse response, Class<T> responseType) {
+    return response.getCode() == HttpStatus.SC_NO_CONTENT
+        || response.getCode() == HttpStatus.SC_NOT_MODIFIED

Review Comment:
   Do we need the extra code check here? Wouldn't the `isSuccessful` already 
cover this?



##########
core/src/test/java/org/apache/iceberg/rest/RESTCatalogAdapter.java:
##########
@@ -433,8 +285,19 @@ public <T extends RESTResponse> T handleRequest(
                   tableIdentFromPathVars(vars),
                   snapshotModeFromQueryParams(httpRequest.queryParameters()));
 
-          responseHeaders.accept(
-              ImmutableMap.of(HttpHeaders.ETAG, 
ETagProvider.of(response.metadataLocation())));
+          Optional<HTTPHeaders.HTTPHeader> ifNoneMatchHeader =
+              httpRequest.headers().entries().stream()
+                  .filter(e -> e.name().equals(HttpHeaders.IF_NONE_MATCH))
+                  .findFirst();

Review Comment:
   I think there's a getFirstHeader on httpRequest, so I think we could 
simplify this a bit.



##########
core/src/test/java/org/apache/iceberg/rest/RESTCatalogAdapter.java:
##########
@@ -433,8 +285,19 @@ public <T extends RESTResponse> T handleRequest(
                   tableIdentFromPathVars(vars),
                   snapshotModeFromQueryParams(httpRequest.queryParameters()));
 
-          responseHeaders.accept(
-              ImmutableMap.of(HttpHeaders.ETAG, 
ETagProvider.of(response.metadataLocation())));
+          Optional<HTTPHeaders.HTTPHeader> ifNoneMatchHeader =
+              httpRequest.headers().entries().stream()
+                  .filter(e -> e.name().equals(HttpHeaders.IF_NONE_MATCH))
+                  .findFirst();
+
+          String eTag = ETagProvider.of(response.metadataLocation());
+          Preconditions.checkNotNull(eTag, "ETag is null");

Review Comment:
   I don't think this checkNotNull is neccessary.



##########
core/src/test/java/org/apache/iceberg/rest/RESTCatalogAdapter.java:
##########
@@ -114,147 +107,6 @@ public RESTCatalogAdapter(Catalog catalog) {
     this.asViewCatalog = catalog instanceof ViewCatalog ? (ViewCatalog) 
catalog : null;
   }
 
-  enum Route {

Review Comment:
   Could we publish a separate PR for this refactoring? I think we could get 
that in first. It'll make this change really just focused on what's necessary 
for supporting not modified 



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