Skip to main content

QueryRow

Struct QueryRow 

Source
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: RowKey

Original row key

§metadata: RowMetadata

Row 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

Source

pub fn new(key: RowKey) -> Self

Create a new query row

Source

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.

Source

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.

Source

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.

Source

pub fn get(&self, column: &str) -> Option<&Value>

Get a value by column name

Source

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.

Source

pub fn column_names(&self) -> Vec<String>

Get all column names

Source

pub fn key(&self) -> &RowKey

Get the row key

Source

pub fn metadata(&self) -> &RowMetadata

Get row metadata

Source

pub fn set_metadata(&mut self, metadata: RowMetadata)

Set row metadata

Source

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.

Source

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).

Source

pub fn get_cell_metadata(&self, column: &str) -> Option<&CellWriteMetadata>

Return the write metadata for column, if present.

Source

pub fn to_json(&self) -> Value

Convert to JSON representation

Trait Implementations§

Source§

impl Clone for QueryRow

Source§

fn clone(&self) -> QueryRow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryRow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for QueryRow

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for QueryRow

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more