Skip to content

Commit 3c33fab

Browse files
authored
GH-3207: ParquetFileReader supports detachFileInputStream (#3208)
1 parent 142bff0 commit 3c33fab

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ public static ParquetFileReader open(InputFile file, ParquetReadOptions options,
729729
return new ParquetFileReader(file, options, f);
730730
}
731731

732-
protected final SeekableInputStream f;
732+
protected SeekableInputStream f;
733733
private final InputFile file;
734734
private final ParquetReadOptions options;
735735
private final Map<ColumnPath, ColumnDescriptor> paths = new HashMap<>();
@@ -1741,6 +1741,14 @@ public OffsetIndex readOffsetIndex(ColumnChunkMetaData column) throws IOExceptio
17411741
Util.readOffsetIndex(f, offsetIndexDecryptor, offsetIndexAAD));
17421742
}
17431743

1744+
/**
1745+
* Explicitly detach the the input stream for the file to avoid being closed via
1746+
* {@link ParquetFileReader#close()}.
1747+
*/
1748+
public void detachFileInputStream() {
1749+
f = null;
1750+
}
1751+
17441752
@Override
17451753
public void close() throws IOException {
17461754
try {

0 commit comments

Comments
 (0)