danielcweeks commented on code in PR #4912:
URL: https://github.com/apache/iceberg/pull/4912#discussion_r898542769


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3InputStream.java:
##########
@@ -172,31 +274,62 @@ private void positionStream() throws IOException {
     }
 
     // close the stream and open at desired position
-    LOG.debug("Seek with new stream for {} to offset {}", location, next);
+    LOG.warn("Seek with new stream for {} to offset {}", location, next);
     pos = next;
     openStream();
   }
 
-  private void openStream() throws IOException {
-    GetObjectRequest.Builder requestBuilder = GetObjectRequest.builder()
-        .bucket(location.bucket())
-        .key(location.key())
-        .range(String.format("bytes=%s-", pos));
-
-    S3RequestUtil.configureEncryption(awsProperties, requestBuilder);
-
+  private void openStream() {
     closeStream();
-    stream = s3.getObject(requestBuilder.build(), 
ResponseTransformer.toInputStream());
+    stream = readRange(String.format("bytes=%s-", pos));
+  }
+
+  private void closeStream() {
+    closeServerSideStream(stream);
+    stream = null;
   }
 
-  private void closeStream() throws IOException {
-    if (stream != null) {
-      stream.close();
+  private static void closeServerSideStream(InputStream streamToClose) {

Review Comment:
   I'd just put this in the close stream (not have a separate method for it).



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