Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25798 +/- ##
==========================================
- Coverage 82.51% 82.51% -0.01%
==========================================
Files 1141 1141
Lines 439801 439801
Branches 439801 439801
==========================================
- Hits 362916 362908 -8
- Misses 54943 54947 +4
- Partials 21942 21946 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
edmondop
marked this pull request as ready for review
September 27, 2026 19:22
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?
Related to apache/datafusion#23194.
Execution model
DataFusion normally drives a query by polling the output streams returned by
ExecutionPlan::execute. Operators pull batches from their inputs; eager operators can also poll inputs in background tasks. This works well for pipelined queries and parallel partitions without requiring a central stage scheduler.An external system needs additional control when it must finish an input subtree before letting downstream work proceed—for example to inspect a materialized result, admit another memory-intensive stage, or replan the remainder. Although operators such as
SortExecalready buffer internally,ExecutionPlanhas no common completion-and-release interface for coordinating those decisions.Rationale for this change
StageBoundaryprovides per-partition priming and readiness, followed by explicit release of buffered output. The caller chooses execution order from the plan dependencies and can inspect completed inputs before releasing them.What changes are included in this PR?
datafusion-physical-plan.InMemoryStageBoundaryExecdemonstration indatafusion-examples. It collects batches into a vector per partition and accounts for them withMemoryReservation.Run an example with:
The admission example waits for a shared memory budget before starting another stage, and returns the budget after the buffered output is consumed.
What is the testing strategy for this PR?
Tests verify that a boundary can finish its input without emitting output, then resume with unchanged partitioned results. They also check that queued admission leaves inputs unstarted until budget is returned, all-partition readiness, dependent boundaries, cancellation of blocked drains, release of reservations when output is dropped, and panic/error propagation. The runnable examples use the same implementation as the tests, and a compiling rustdoc example checks the public API.
Are there any user-facing changes?
Adds a public
StageBoundarytrait and example commands. ExistingExecutionPlanimplementations and SQL behavior are unaffected.