Expand description
Push-based execution of physical plans as pipelines.
A Scan runs a PlanRef over a list of splits, row ranges
of the plan’s domain. Each split is compiled into pipelines: a pipeline is one
Source, zero or more Operators,
and the ports its last stage writes. The driver asks the source for a batch and pushes it
through the stages into the ports. Every port runs from one pipeline’s sink,
the end that pushes into its outlets, to another’s source, which reads it as an inlet, and
the plan joining them declares how many batches each inlet may hold.
A source checks its readiness before computing, waiting for a segment read or an inlet. The driver also blocks a pipeline when an outlet is full. The scheduler re-runs a blocked pipeline when that one condition clears.
The owner of a scan answers reads: Scan::step returns each read as a Turn::Read, and
Scan::deliver hands its bytes back. Nothing in a scan awaits.
§Masks
Every mask a scan applies is known when the pipelines that apply it are compiled: the split’s selection, and the rows the earlier conjuncts kept. The compiler places the mask in the stage that reads the rows, so chunks a mask selects nothing of are never built and never read.
§Sharing
A segment several readers decode is decoded once. Before the scan starts, one pass over the plans every split’s stages run records the rows each segment is read for, so the splits that will read it are found by binary search over the splits. The first reader of a segment read more than once builds one pipeline that decodes it and fans the decoded array out into one single-use port per reader, tagged with the reader’s split: a reader in the same stage, a later stage of a query, or a later split claims its own port. A split’s ports it never claims, because its rows were pruned or a stage never ran, leave the sharing pipeline’s outlets and are freed when it finishes, so nothing is ever pushed into a port nobody will read, and a claimed port is dropped once its source has drained it, so a decoded segment lives only as long as a split that may still read it.
Modules§
- synthetic
- Plans whose chains are built by hand, for exercising pipelines without layouts.
Structs§
- Chain
- A pipeline under construction: a source and the stages after it, not yet given outlets, so a parent plan can add stages before it becomes a pipeline.
- Compiler
- What a plan compiles its children through. See
PlanVTable::compile. - Inlet
- The reading side of a port, borrowed for one call.
- ReadId
- Identifies a read a scan asked its owner for.
- Read
Request - A segment the scan needs read.
- Scan
- Runs a plan over a list of splits.
- Split
- A row range of the plan’s domain, and the rows of it to produce.
- Value
Cache - Values a plan produces over its whole domain whatever rows it is compiled for, kept for the later scans that share this cache.
Enums§
Constants§
- DEFAULT_
CAPACITY - Batches an inlet holds before its sink is blocked, unless the plan joining it says
otherwise; see
Compiler::join_with.