apache / apache/datafusion

Push Down Offset to TableScan

Open
#5,562 0 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? Please describe what you are trying to do.**

TableScan currently contains a single `fetch` parameter, that acts as an overall limit.

The PushDownLimit optimizer rule is therefore forced to push down the `limit + offset`, even though it determines both separately.

Pushing down the offset separately allows formats to skip decoding lines in the case of CSV or JSON, or skip even fetching the corresponding bytes in the case of parquet.

**Describe the solution you'd like**

I would suggest removing `TableScan::fetch` and replacing it with separate limit and offset fields. These could then be pushed down in TableProvider, and FileScanConfig. This would likely need to be a breaking change.

**Describe alternatives you've considered**

**Additional context**

Contributor guide

Open the contributing guide

Research direction

Start by tracing TableScan and the PushDownLimit optimizer rule, then inspect the TableProvider and FileScanConfig interfaces named in the issue. Determine how limit and offset are currently represented and propagated across these entry points. Done means the two values can be pushed down separately without leaving fetch-only call sites or breaking the relevant interfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.