apache / apache/parquet-java

ParquetFileWriter.appendFile does not close file handle - resource leak

Open
#2,039 0 comments 0 reactions 0 assignees View on GitHub
Component: Java Component: Parquet Priority: Major Type: bug
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
33

Description

Current implementation of the method ParquetFileWriter.appendFile does not close file handle.
```Java
ParquetFileReader.open(conf, file).appendTo(this);
```

My suggested fix is following:
```Java
try (ParquetFileReader reader = ParquetFileReader.open(conf, file)) {
reader.appendTo(this);
}
```

**Reporter**: [George Smith](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=cabot)
#### PRs and other links:
- [GitHub Pull Request #708](https://github.com/apache/parquet-mr/pull/708)

**Note**: *This issue was originally created as [PARQUET-870](https://issues.apache.org/jira/browse/PARQUET-870). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at ParquetFileWriter.appendFile and inspect how the ParquetFileReader returned by ParquetFileReader.open is managed. Review Pull Request #708 for the existing work, then verify that the reader and its file handle are closed after appendFile completes using the relevant project tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.