vinothchandar commented on a change in pull request #2500:
URL: https://github.com/apache/hudi/pull/2500#discussion_r593853240



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java
##########
@@ -107,6 +96,59 @@ public HoodieLogFileReader(FileSystem fs, HoodieLogFile 
logFile, Schema readerSc
     this(fs, logFile, readerSchema, DEFAULT_BUFFER_SIZE, false, false);
   }
 
+  /**
+   * Fetch the right {@link FSDataInputStream} to be used by wrapping with 
required input streams.
+   * @param fsDataInputStream original instance of {@link FSDataInputStream}.
+   * @param fs instance of {@link FileSystem} in use.
+   * @param bufferSize buffer size to be used.
+   * @return the right {@link FSDataInputStream} as required.
+   */
+  private FSDataInputStream getFSDataInputStream(FSDataInputStream 
fsDataInputStream, FileSystem fs, int bufferSize) {
+    FSDataInputStream toReturnInputStream;
+    if (FSUtils.isGCSFileSystem(fs)) {
+      // in GCS FS, we might need to interceptor seek offsets as we might get 
EOF exception
+      toReturnInputStream = new 
SchemeAwareFSDataInputStream(getFSDataInputStreamForGCSFs(fsDataInputStream, 
bufferSize), true);
+    } else {
+      if (fsDataInputStream.getWrappedStream() instanceof FSInputStream) {
+        toReturnInputStream = new TimedFSDataInputStream(logFile.getPath(), 
new FSDataInputStream(
+            new BufferedFSInputStream((FSInputStream) 
fsDataInputStream.getWrappedStream(), bufferSize)));
+      } else {
+        // fsDataInputStream.getWrappedStream() maybe a BufferedFSInputStream

Review comment:
       these two lines are comment are copy-reused also down below? 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to