apache / apache/datafusion-ballista
Small files problem.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 320
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 66
Description
I observed that an excessive number of small files significantly increases physical plan generation time and memory consumption.
Here are my test results:
I tested with a 100GB TPC-DS dataset, where the store_returns table is 4GB and partitioned with over 200,000 files. I loaded the data locally, registered it as a table using the register_parquet API, and executed:
```
SELECT count(*) FROM store_returns;
```
The query took 81.39 seconds, with the log showing:
```
Planned job QiZU0fh in 81.057936897s
```
After merging the files in the store_returns directory down to 4,032 files, the same query took only 16.84 seconds, with the log showing:
```
Planned job 7534D1z in 16.758905506s
```
This clearly demonstrates that the performance difference is primarily caused by the physical plan generation phase.
Additionally, when executing TPC-DS Q1 with too many small files, I observed the scheduler memory continuously increasing, eventually causing the process to crash. After merging the small files, the query executed successfully in just over 70 seconds.
Contributor guide
Research direction
Reproduce the report with the register_parquet API, the store_returns table, and SELECT count(*) against the two file counts described. Start by tracing physical plan generation and scheduler memory behavior for many small files; done should include a confirmed reduction in planning time and prevention of the reported memory growth, with the relevant tests or benchmark results documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- distributed-systems, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100