sumeetgajjar commented on code in PR #4465:
URL: https://github.com/apache/iceberg/pull/4465#discussion_r843335983


##########
azure/src/main/java/org/apache/iceberg/azure/blob/AzureBlobInputStream.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.azure.blob;
+
+import com.azure.storage.blob.BlobClient;
+import com.azure.storage.blob.models.BlobRange;
+import com.azure.storage.blob.options.BlobInputStreamOptions;
+import com.azure.storage.blob.specialized.BlobInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import org.apache.iceberg.azure.AzureProperties;
+import org.apache.iceberg.io.SeekableInputStream;
+import org.apache.iceberg.relocated.com.google.common.base.Joiner;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AzureBlobInputStream extends SeekableInputStream {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(AzureBlobInputStream.class);
+  private static final Joiner TRACE_JOINER = Joiner.on("\n\t");
+
+  private final StackTraceElement[] createStack;
+  private final AzureURI azureURI;
+  private final AzureProperties azureProperties;
+  private final BlobClient blobClient;
+
+  private long pos = 0L;
+  private boolean closed = false;
+  private BlobInputStream stream;
+
+  public AzureBlobInputStream(AzureURI azureURI, AzureProperties 
azureProperties, BlobClient blobClient) {
+    this.createStack = Thread.currentThread().getStackTrace();
+    this.azureURI = azureURI;
+    this.azureProperties = azureProperties;
+    this.blobClient = blobClient;
+    openStream(/* offset = */ 0);
+  }
+
+  @Override
+  public long getPos() {
+    return pos;
+  }
+
+  @Override
+  public void seek(long newPos) {

Review Comment:
   Hi @rbalamohan - can you please elaborate more on the reverse seek issues?
   
   For the reverse seek case, we close the current stream and re-open the 
stream from the earlier offset.
   ```
   // Seeking backward.
   stream.close();
   openStream(newPos); // newPos is a position back in the stream. 
   ```



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