@@ -729,7 +729,22 @@ public static ParquetFileReader open(InputFile file, ParquetReadOptions options,
729729 return new ParquetFileReader (file , options , f );
730730 }
731731
732- protected SeekableInputStream f ;
732+ /**
733+ * Open a {@link InputFile file} with {@link ParquetMetadata footer} and {@link ParquetReadOptions options}.
734+ *
735+ * @param file an input file
736+ * @param footer a {@link ParquetMetadata} footer already read from the file
737+ * @param options parquet read options
738+ * @param f the input stream for the file
739+ * @return an open ParquetFileReader
740+ * @throws IOException if there is an error while opening the file
741+ */
742+ public static ParquetFileReader open (InputFile file , ParquetMetadata footer , ParquetReadOptions options , SeekableInputStream f )
743+ throws IOException {
744+ return new ParquetFileReader (file , footer , options , f );
745+ }
746+
747+ protected final SeekableInputStream f ;
733748 private final InputFile file ;
734749 private final ParquetReadOptions options ;
735750 private final Map <ColumnPath , ColumnDescriptor > paths = new HashMap <>();
@@ -930,6 +945,12 @@ public ParquetFileReader(InputFile file, ParquetReadOptions options) throws IOEx
930945 this (file , options , file .newStream ());
931946 }
932947
948+ /**
949+ * @param file Path to a parquet file
950+ * @param options {@link ParquetReadOptions}
951+ * @param f a {@link SeekableInputStream} for the parquet file
952+ * @throws IOException if the file can not be opened
953+ */
933954 public ParquetFileReader (InputFile file , ParquetReadOptions options , SeekableInputStream f ) throws IOException {
934955 this .converter = new ParquetMetadataConverter (options );
935956 this .file = file ;
@@ -938,6 +959,8 @@ public ParquetFileReader(InputFile file, ParquetReadOptions options, SeekableInp
938959 try {
939960 this .footer = readFooter (file , options , f , converter );
940961 } catch (IOException e ) {
962+ // In case that reading footer throws an exception in the constructor, the new stream
963+ // should be closed. Otherwise, there's no way to close this outside.
941964 f .close ();
942965 throw e ;
943966 }
@@ -971,6 +994,13 @@ public ParquetFileReader(InputFile file, ParquetReadOptions options, SeekableInp
971994 }
972995 }
973996
997+ /**
998+ * @param file Path to a parquet file
999+ * @param footer a {@link ParquetMetadata} footer already read from the file
1000+ * @param options {@link ParquetReadOptions}
1001+ * @param f a {@link SeekableInputStream} for the parquet file
1002+ * @throws IOException if the file can not be opened
1003+ */
9741004 public ParquetFileReader (InputFile file , ParquetMetadata footer , ParquetReadOptions options , SeekableInputStream f )
9751005 throws IOException {
9761006 this .converter = new ParquetMetadataConverter (options );
0 commit comments