pub struct QueryRow {
pub values: HashMap<Arc<str>, Value>,
pub key: RowKey,
pub metadata: RowMetadata,
pub cell_metadata: Option<HashMap<String, CellWriteMetadata>>,
}Expand description
Individual row in query result
Fields§
§values: HashMap<Arc<str>, Value>Column values mapped by column name.
Keyed by a shared Arc<str> column-name handle (issue #1334) interned
once by the decoder, so carrying a decoded cell’s name into the row is a
reference-count bump rather than a per-cell heap String allocation.
Arc<str>: Borrow<str>, so all name-based reads (get(&str), keys(),
iteration) are source-compatible with the prior String key. serde’s
rc feature makes this (de)serialize with the identical name→value JSON
object shape.
key: RowKeyOriginal row key
metadata: RowMetadataRow metadata
cell_metadata: Option<HashMap<String, CellWriteMetadata>>Per-cell write metadata (Issue #691).
Populated only when ProjectionFlags::include_cell_metadata is
true during query planning. None on the hot path — no allocation
is performed unless metadata is explicitly requested.
Map key = column name; value = write timestamp + optional expiration. Columns absent from this map either had no individual cell header in the SSTable (e.g. partition-key columns) or were not decoded under the current flag setting.
Implementations§
Source§impl QueryRow
impl QueryRow
Sourcepub fn with_values(key: RowKey, values: HashMap<String, Value>) -> Self
pub fn with_values(key: RowKey, values: HashMap<String, Value>) -> Self
Create a row with values.
Concrete over HashMap<String, Value> so existing callers (including
QueryRow::with_values(key, HashMap::new())) infer the key type without
annotations (issue #1334); the string keys are interned into shared
Arc<str> handles once here. Callers that already hold interned
Arc<str> keys should use QueryRow::with_interned_values to skip the
re-allocation.
Sourcepub fn with_interned_values(
key: RowKey,
values: HashMap<Arc<str>, Value>,
) -> Self
pub fn with_interned_values( key: RowKey, values: HashMap<Arc<str>, Value>, ) -> Self
Create a row from already-interned Arc<str> column-name handles.
The interned-key counterpart of QueryRow::with_values (issue #1334):
the storage/scan path already carries interned Arc<str> names, so the
handles move straight in with only a reference-count bump — no per-cell
String allocation.
Sourcepub fn from_map(values: HashMap<String, Value>) -> Self
pub fn from_map(values: HashMap<String, Value>) -> Self
Create a row from a column name → value map, using a synthetic empty key.
Convenience constructor used by CLI utilities that do not track a raw
partition key. The key is set to an empty byte vector. Concrete over
HashMap<String, Value> so HashMap::new() callers infer without
annotations (issue #1334); the string keys are interned here.
Sourcepub fn set(&mut self, column: impl Into<Arc<str>>, value: Value)
pub fn set(&mut self, column: impl Into<Arc<str>>, value: Value)
Set a value for a column.
Accepts anything convertible into the shared Arc<str> key (issue
#1334): a String, &str, or an existing Arc<str> handle.
Sourcepub fn column_names(&self) -> Vec<String>
pub fn column_names(&self) -> Vec<String>
Get all column names
Sourcepub fn metadata(&self) -> &RowMetadata
pub fn metadata(&self) -> &RowMetadata
Get row metadata
Sourcepub fn set_metadata(&mut self, metadata: RowMetadata)
pub fn set_metadata(&mut self, metadata: RowMetadata)
Set row metadata
Sourcepub fn set_cell_metadata(&mut self, map: HashMap<String, CellWriteMetadata>)
pub fn set_cell_metadata(&mut self, map: HashMap<String, CellWriteMetadata>)
Attach per-cell write metadata to this row.
Replaces any previously attached map. Intended to be called by the
scan/build path when ProjectionFlags::include_cell_metadata is set.
Sourcepub fn insert_cell_metadata(&mut self, column: String, meta: CellWriteMetadata)
pub fn insert_cell_metadata(&mut self, column: String, meta: CellWriteMetadata)
Insert a single column’s write metadata.
Initialises the map on first call; subsequent calls insert into the existing map. No-op when called on the hot path that never enables metadata (the caller guards on the flag).
Sourcepub fn get_cell_metadata(&self, column: &str) -> Option<&CellWriteMetadata>
pub fn get_cell_metadata(&self, column: &str) -> Option<&CellWriteMetadata>
Return the write metadata for column, if present.