Add ObjectStore-backed TempFileFactor / spill example#23170
Open
alamb wants to merge 6 commits into
Open
Conversation
alamb
force-pushed
the
codex/object-store-spill-example
branch
from
June 24, 2026 22:16
4dfdfcb to
e97ed5d
Compare
alamb
commented
Jun 24, 2026
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| //! See `main.rs` for how to run it. |
Contributor
Author
There was a problem hiding this comment.
This is the whole point of this PR: an example of implementing remote spilling
alamb
force-pushed
the
codex/object-store-spill-example
branch
from
June 29, 2026 19:36
b5fe466 to
180d421
Compare
alamb
force-pushed
the
codex/object-store-spill-example
branch
from
June 29, 2026 20:58
180d421 to
584169f
Compare
alamb
commented
Jun 29, 2026
| self | ||
| } | ||
|
|
||
| /// Configure a custom factory for creating temporary spill files. |
Contributor
Author
There was a problem hiding this comment.
This is a small API to make configuring spill files easier
alamb
marked this pull request as ready for review
June 29, 2026 20:59
Comment on lines
+187
to
+189
| Ok(Box::pin(stream::once(async move { | ||
| Ok(store.get(&location).await?.bytes().await?) | ||
| }))) |
Contributor
There was a problem hiding this comment.
Nit. bytes().await collects the entrie spill opbject into a single Bytes before DataFusion can consume it. Since SpillFile::read_stream already returns a byte stream, I think we can preserve chunked reads by deferring the async get() and flattening the object-store stream, roughly:
let stream = stream::once(async move {
store.get(&location).await.map(|result| result.into_stream())
})
.try_flatten()
.map_err(Into::into);
Ok(Box::pin(stream))
Contributor
|
Looks good to me @alamb, thank you for this clean example! |
Phoenix500526
approved these changes
Jul 1, 2026
Phoenix500526
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me too. 😊
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
PR #21882 adds custom spill file support.
Having an example showing how a downstream application can use this new API will help make sure the API is good enough for our needs
What changes are included in this PR?
This PR adds a small example showing how users can back spill files with an
ObjectStore, using a local object store for a runnable example while keeping the implementation applicable to remote stores.Are these changes tested?
Yes by CI
Are there any user-facing changes?
Yes. This adds a new example for configuring ObjectStore-backed spill files.