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



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java
##########
@@ -75,13 +76,13 @@
   public HoodieLogFileReader(FileSystem fs, HoodieLogFile logFile, Schema 
readerSchema, int bufferSize,
                              boolean readBlockLazily, boolean reverseReader) 
throws IOException {
     FSDataInputStream fsDataInputStream = fs.open(logFile.getPath(), 
bufferSize);
-    if (FSUtils.isGCSInputStream(fsDataInputStream)) {
-      this.inputStream = new TimedFSDataInputStream(logFile.getPath(), new 
FSDataInputStream(
-          new BufferedFSInputStream((FSInputStream) ((
-              (FSDataInputStream) 
fsDataInputStream.getWrappedStream()).getWrappedStream()), bufferSize)));
-    } else if (fsDataInputStream.getWrappedStream() instanceof FSInputStream) {
+    if (fsDataInputStream.getWrappedStream() instanceof FSInputStream) {
       this.inputStream = new TimedFSDataInputStream(logFile.getPath(), new 
FSDataInputStream(
           new BufferedFSInputStream((FSInputStream) 
fsDataInputStream.getWrappedStream(), bufferSize)));
+    } else if (FSUtils.isGCSFileSystem(fs)) {

Review comment:
       I had two options. either check two conditions like
   ```
   if(fsDataInputStream.getWrappedStream() instance of FSDataInputStream && 
((FSDataInputStream)fsDataInputStream.getWrappedStream()).getWrappedStream() 
instance of FSInputStream)
   ```
   or resort to casting and if exception if thrown fallback to original 
dataInputStream. I have gone w/ 2nd approach. 




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