Jackie-Jiang commented on a change in pull request #8244:
URL: https://github.com/apache/pinot/pull/8244#discussion_r813479358



##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/data/readers/RecordReaderUtils.java
##########
@@ -50,7 +49,7 @@ public static BufferedInputStream getBufferedInputStream(File 
dataFile)
 
   public static InputStream getInputStream(File dataFile)
       throws IOException {
-    if (dataFile.getName().endsWith(GZIP_FILE_EXTENSION)) {
+    if (GzipUtils.isGZipped(dataFile)) {

Review comment:
       Suggest directly trying to open a GZIPInputStream, which will do all the 
necessary validations (besides the magic short check which might not be enough)
   ```suggestion
       FileInputStream fileInputStream = new FileInputStream(dataFile);
       try {
         return new GZIPInputStream(fileInputStream);
       } catch (Exception e) {
         // NOTE: Cannot reuse the input stream because it might already be read
         fileInputStream.close();
         return new FileInputStream(dataFile);
       }
   ```




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