apache / apache/parquet-java

Files opened by ParquetFileWriter’s appendFile method should to be closed correctly

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

Description

I try to use the `appendFile` method of `ParquetFileWriter` to merge some smaller Parquet files into one large parquet file. After I finished the merge, I tried deleting the smaller files, but couldn't actually delete them.

After reading the ParquetFileWriter source code, I found that the file he opened was not closed in the end method, which seemed unreasonable.

 

When testing on `Windows`, it was found that these implicitly opened files cannot be deleted or renamed. This seems to be related to Windows file handles. But it's worked fine on macOS.

Anyway, I will submit a patch to ensure that files opened through the appendFile function are closed correctly.

**Reporter**: [Deng An](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=packyan)
#### PRs and other links:
- [GitHub Pull Request #1351](https://github.com/apache/parquet-java/pull/1351)
- [GitHub Pull Request #1351](https://github.com/apache/parquet-mr/pull/1351)

**Note**: *This issue was originally created as [PARQUET-2477](https://issues.apache.org/jira/browse/PARQUET-2477). 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 with ParquetFileWriter.appendFile and its end method, as identified in the issue. Reproduce the merge on Windows and verify that the smaller Parquet files can be deleted or renamed after completion; the linked pull request indicates that work is already underway.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
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.