pan3793 commented on code in PR #3165:
URL: https://github.com/apache/parquet-java/pull/3165#discussion_r2055399328


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java:
##########
@@ -932,12 +932,48 @@ public ParquetFileReader(InputFile file, 
ParquetReadOptions options, SeekableInp
     this.options = options;
     try {
       this.footer = readFooter(file, options, f, converter);
+    } catch (IOException e) {
+      f.close();
+      throw e;
+    }
+
+    this.fileMetaData = footer.getFileMetaData();
+    this.fileDecryptor = fileMetaData.getFileDecryptor(); // must be called 
before filterRowGroups!
+    if (null != fileDecryptor && fileDecryptor.plaintextFile()) {
+      this.fileDecryptor = null; // Plaintext file. No need in decryptor
+    }
+
+    try {
+      this.blocks = filterRowGroups(footer.getBlocks());
     } catch (Exception e) {
-      // In case that reading footer throws an exception in the constructor, 
the new stream
+      // In case that filterRowGroups throws an exception in the constructor, 
the new stream
       // should be closed. Otherwise, there's no way to close this outside.
       f.close();
       throw e;
     }
+    this.blockIndexStores = listWithNulls(this.blocks.size());
+    this.blockRowRanges = listWithNulls(this.blocks.size());
+    for (ColumnDescriptor col : 
footer.getFileMetaData().getSchema().getColumns()) {
+      paths.put(ColumnPath.get(col.getPath()), col);
+    }
+
+    if (options.usePageChecksumVerification()) {
+      this.crc = new CRC32();
+      this.crcAllocator = 
ReusingByteBufferAllocator.strict(options.getAllocator());
+    } else {
+      this.crc = null;
+      this.crcAllocator = null;
+    }
+  }
+
+  public ParquetFileReader(InputFile file, ParquetMetadata footer, 
ParquetReadOptions options, SeekableInputStream f)

Review Comment:
   Please add the corresponding `static open` method together



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