pub enum RowRef {
Owned(Row),
Composite(CompositeRow),
DirectBuildComposite(DirectBuildCompositeRow),
Shared(SharedRow),
Projected(ProjectedRow),
Deferred(DeferredRow),
}Expand description
A row reference that can be borrowed, owned, or composite.
This enum allows operators to return rows without always cloning:
Borrowed: Reference to an existing row (zero-copy)Owned: An owned row (when materialization is needed)Composite: Virtual row combining left and right join sides
§Performance
The key optimization is that Composite allows hash joins to
return combined rows without actually copying values from both sides.
Values are only copied when the final result is materialized.
Variants§
Owned(Row)
Owned row - the row data is owned by this RowRef.
Composite(CompositeRow)
Composite row - combines two rows without copying. Used by join operators to avoid materializing combined rows.
DirectBuildComposite(DirectBuildCompositeRow)
Direct build composite - combines owned probe row with Arc-referenced build rows. OPTIMIZATION: Avoids Arc allocation for probe row (saves 1 allocation per match). Used for hash joins where build rows are shared via Arc.
One row in an immutable shared build batch.
This lets a projected JOIN output retain the build row by Arc + index instead of cloning every value from that row.
Projected(ProjectedRow)
Projected virtual row over an existing outer row and one joined row.
Unlike an owned projected Row, this keeps the selected slots virtual
across subsequent JOIN edges. Values are copied only when the final
result consumer requests an owned row.
Deferred(DeferredRow)
Deferred row carried through an internal QueryResult boundary.
Implementations§
Source§impl RowRef
impl RowRef
Sourcepub fn composite(left: Row, right: Row) -> Self
pub fn composite(left: Row, right: Row) -> Self
Create a composite RowRef from left and right rows.
Sourcepub fn into_owned(self) -> Row
pub fn into_owned(self) -> Row
Convert to an owned Row.
For Owned, this is a no-op move.
For Composite and DirectBuildComposite, this materializes the combined row.
Sourcepub fn to_owned(&self) -> Row
pub fn to_owned(&self) -> Row
Clone to an owned Row.
Use into_owned() when possible to avoid cloning.
Sourcepub fn direct_build_composite(
probe: Row,
build_rows: CompactArc<Vec<Row>>,
build_idx: usize,
probe_is_left: bool,
) -> Self
pub fn direct_build_composite( probe: Row, build_rows: CompactArc<Vec<Row>>, build_idx: usize, probe_is_left: bool, ) -> Self
Create a direct-build composite RowRef.
OPTIMIZATION: Avoids Arc allocation for probe row. Use this for 1:1 joins where probe row is owned and not shared.
Reference one row in an immutable shared batch.
Sourcepub fn projected(
left: RowRef,
right: RowRef,
columns: CompactArc<[ColumnSource]>,
) -> Self
pub fn projected( left: RowRef, right: RowRef, columns: CompactArc<[ColumnSource]>, ) -> Self
Create a deferred projected row for a JOIN output.
Sourcepub fn deferred(row: DeferredRow) -> Self
pub fn deferred(row: DeferredRow) -> Self
Restore a compact row received from an internal QueryResult boundary.
Sourcepub fn into_deferred(self) -> DeferredRow
pub fn into_deferred(self) -> DeferredRow
Convert into the portable representation used between recursive JOINs.
Sourcepub fn is_deferred(&self) -> bool
pub fn is_deferred(&self) -> bool
Whether this row still carries a deferred JOIN representation.
Sourcepub fn estimated_retained_bytes(&self) -> usize
pub fn estimated_retained_bytes(&self) -> usize
Conservative size of the request-local row graph retained by this handle. Arc-backed immutable batches are owned and charged elsewhere; this method accounts only for the handle/graph added by a pull batch.