apache / apache/datafusion

How to provide a custom `Context` in `TableProvider`'s `scan`?

Open
#8,926 6 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?

`TableProvider`'s `scan` often load a lot of data from some place. if somehow this request is cancelled, we can drop the `scan` .
can save us a lot of cpu times. right now there is no way to pass the custom context for each `scan` .

### Describe the solution you'd like

since scan take a `SessionState` as parameter .
we can add a field to this struct.
~~~
pub struct SessionState {
...
context : Option>,
...
}
~~~

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing TableProvider::scan and the SessionState entry point to understand how scan requests receive state today. Define how a per-scan custom context is carried and what cancellation behavior should result, then verify the affected scan paths and tests cover the new behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.