[ https://issues.apache.org/jira/browse/PARQUET-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552286#comment-17552286 ]
ASF GitHub Bot commented on PARQUET-2154: ----------------------------------------- LuciferYang commented on PR #972: URL: https://github.com/apache/parquet-mr/pull/972#issuecomment-1151319153 @ggershinsky I found Travis CI failed, but `Raw log` is null <img width="1102" alt="image" src="https://user-images.githubusercontent.com/1475305/172891856-e8acc55a-99cd-4023-9e31-e0fac5b9d1e4.png"> What should I do now? > ParquetFileReader should close its input stream when `filterRowGroups` throw > Exception in constructor > ----------------------------------------------------------------------------------------------------- > > Key: PARQUET-2154 > URL: https://issues.apache.org/jira/browse/PARQUET-2154 > Project: Parquet > Issue Type: Bug > Reporter: Yang Jie > Priority: Major > > > {code:java} > public ParquetFileReader(InputFile file, ParquetReadOptions options) throws > IOException { > this.converter = new ParquetMetadataConverter(options); > this.file = file; > this.f = file.newStream(); > this.options = options; > try { > this.footer = readFooter(file, options, f, converter); > } catch (Exception e) { > // In case that reading footer 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.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 > } > this.blocks = filterRowGroups(footer.getBlocks()); > 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); > } > this.crc = options.usePageChecksumVerification() ? new CRC32() : null; > } {code} > During the construction of ParquetFileReader, if `filterRowGroups` method > throws an exception, it will cause resource leak because when > `filterRowGroups(footer.getBlocks())` throw an Exception, the open stream > `{{{}this.f = file.newStream()`{}}} looks unable to be closed. > -- This message was sent by Atlassian Jira (v8.20.7#820007)