Expand description
DataChunk: Basic unit of streaming execution
A DataChunk represents a fixed-size batch of rows processed in streaming mode. Typical size: 2048 rows (~8MB, OLAP vectorized batch)
§Ownership & Memory Accounting Rules
rows: OwnedVec<Vec<Value>>.Cloneperforms an explicit deep copy (there is no shallow-clone path).schema:Arc<Schema>— shared reference, cheapArc::cloneonClone.layout:Arc<SlotLayout>— always present; shared reference, cheap onClone.memory_reservation:Option<MemoryReservation>/Option<MemoryPoolReservation>— ownership stays with the original chunk onClone; the clone getsNone. Usetake_memory_reservation()to transfer ownership explicitly.
§Move-first discipline
New code moves rows instead of cloning them:
expand_visible_rows(): the single terminal move (visible rows out, expanded bymultiplicity); used byLocalChunkCollectorand everycollectpath.visible_rows(): the single borrow of visible rows (selection aware).take_indices/slice: move a subset of rows into a new chunk (efficient, usesstd::mem::takeper row), preservingmultiplicity.Clone: the single explicit deep copy. It drops memory reservations and the deferred-build flag; the new owner must re-account memory via its own pool/tracker.
§Construction Paths
new_with_layout(rows, layout)— Production path. Schema is derived from layout slot metadata. Always preferred when aSlotLayoutis available.new(rows, schema)— Schema-driven path. Layout auto-created from column names.from_rows(rows)/from_rows_with_col_names(rows, col_names)— Convenience constructors for tests. Always produce a layout (auto-created).project_columns(columns, layout)— DesignatedProjectoutput path; rebuilds the typed layout unconditionally because the output is chunk-bounded.from_columnsis the crate-private row-major fixture behind it.
§Columnar gating
Fresh column sets from storage scans and join outputs honor
use_columnar_path; small 1:1 rebuilds (project, assign) rebuild
unconditionally by design. Blocking accumulation uses ColumnarBatch
(typed) for sort/topn and MaterializedBatch (spill form) elsewhere.
Structs§
- Column
Info - Columnar
Batch - Column-major accumulation of a full relation (one
BatchColumnper output column), used by blocking operators below the spill boundary. - Columnar
Policy - Adaptive gate for the typed columnar chunk layout (cross-query shared).
- Data
Chunk - A chunk of rows processed in streaming execution
- Edge
Header Column - Struct-of-arrays edge identity column: one
(src, dst, edge_type, ranking)tuple per row with no property map and no storage-internal identifier. All four vectors always share one length; every constructor and mutator below maintains that invariant together, so element access stays index-aligned without per-access checks. - Local
Chunk Collector - Thread-local terminal accumulator for query results.
- Query
Columnar Override - Per-query override for the shared
ColumnarPolicydecision. - RowBuffer
Pool - Process-global row-buffer pool.
- Schema
- Simple schema representation
Enums§
- Batch
Column - Typed
Column - Typed
Kind - Kind of a typed fixed-size scalar column.
Constants§
- COLLECTOR_
BLOCK_ ROWS - Rows per collector block. Bounds the reallocation peak of a single push.
- DEFAULT_
CHUNK_ SIZE - Alias for the default chunk size (kept in sync with
ExecutionContext::DEFAULT_CHUNK_SIZE). - MAX_
POOLED_ ROWS - MAX_
POOLED_ ROW_ CAPACITY - VECTORIZED_
BATCH_ SIZE - OLAP vectorized batch size.