apache / apache/datafusion

No efficient way to load a subset of files from partitioned table

Open
#8,906 9 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

As far as I can tell, there is no good way to load a subset of files from a partitioned table. Using `ListingTable` or another `TableProvider` like `DeltaTableProvider` from `deltalake`, I'm able to `read_table`, but this loads the entire table. I can also load a list of parquet files with `read_parquet`, but this doesn't work with partitioned tables if the partitions are not "materialized" columns in the raw parquet. The only way I've found to load partitioned files is by iterating over a list of file paths, and doing the entire `TableProvider`/`read_table` process on each one individually, and `union`ing the results together.

### Describe the solution you'd like

It seems like it would be nice to be able to create a `TableProvider` with a table path, then pass some sort of file "whitelist" in. Maybe a `read_table_files(TableProvider, impl IntoIterator)`.

### Describe alternatives you've considered

As stated above, I've tried reading the files one-by-one and `union`ing results, but it's shockingly inefficient compared to reading all files at once.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the TableProvider, read_table, and read_parquet entry points named in the issue, including how partitioned-file paths are selected. Done means a table can load an explicit subset of files while preserving partition handling and avoiding the inefficient per-file reads followed by union.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.