pub struct StorageTableInner<S: StateStore, SD: ValueRowSerde> {Show 15 fields
table_id: TableId,
store: S,
schema: Schema,
pk_serializer: OrderedRowSerde,
output_indices: Vec<usize>,
key_output_indices: Option<Vec<usize>>,
value_output_indices: Vec<usize>,
output_row_in_key_indices: Vec<usize>,
mapping: Arc<ColumnMapping>,
epoch_idx: Option<usize>,
row_serde: Arc<SD>,
pk_indices: Vec<usize>,
distribution: TableDistribution,
table_option: TableOption,
read_prefix_len_hint: usize,
}
Expand description
StorageTableInner
is the interface accessing relational data in KV(StateStore
) with
row-based encoding format, and is used in batch mode.
Fields§
§table_id: TableId
Id for this table.
store: S
State store backend.
schema: Schema
The schema of the output columns, i.e., this table VIEWED BY some executor like
RowSeqScanExecutor
.
pk_serializer: OrderedRowSerde
Used for serializing and deserializing the primary key.
output_indices: Vec<usize>
§key_output_indices: Option<Vec<usize>>
the key part of output_indices
.
value_output_indices: Vec<usize>
the value part of output_indices
.
output_row_in_key_indices: Vec<usize>
used for deserializing key part of output row from pk.
mapping: Arc<ColumnMapping>
Mapping from column id to column index for deserializing the row.
epoch_idx: Option<usize>
The index of system column _rw_timestamp
in the output columns.
row_serde: Arc<SD>
Row deserializer to deserialize the value in storage to a row. The row can be either complete or partial, depending on whether the row encoding is versioned.
pk_indices: Vec<usize>
Indices of primary key. Note that the index is based on the all columns of the table, instead of the output ones.
distribution: TableDistribution
§table_option: TableOption
Used for catalog table_properties
read_prefix_len_hint: usize
Implementations§
source§impl<S: StateStore> StorageTableInner<S, EitherSerde>
impl<S: StateStore> StorageTableInner<S, EitherSerde>
sourcepub fn new_partial(
store: S,
output_column_ids: Vec<ColumnId>,
vnodes: Option<Arc<Bitmap>>,
table_desc: &StorageTableDesc,
) -> Self
pub fn new_partial( store: S, output_column_ids: Vec<ColumnId>, vnodes: Option<Arc<Bitmap>>, table_desc: &StorageTableDesc, ) -> Self
Create a StorageTableInner
given a complete set of columns
and a partial
set of output_column_ids
.
When reading from the storage table,
the chunks or rows will only contain columns with the given ids (output_column_ids
).
They will in the same order as the given output_column_ids
.
NOTE(kwannoel): The output_column_ids
here may be slightly different
from those supplied to associated executors.
These output_column_ids
may have pk
appended, since they will be needed to scan from
storage. The associated executors may not have these pk
fields.
pub fn for_test_with_partial_columns( store: S, table_id: TableId, columns: Vec<ColumnDesc>, output_column_ids: Vec<ColumnId>, order_types: Vec<OrderType>, pk_indices: Vec<usize>, value_indices: Vec<usize>, ) -> Self
pub fn for_test( store: S, table_id: TableId, columns: Vec<ColumnDesc>, order_types: Vec<OrderType>, pk_indices: Vec<usize>, value_indices: Vec<usize>, ) -> Self
fn new_inner( store: S, table_id: TableId, table_columns: Vec<ColumnDesc>, output_column_ids: Vec<ColumnId>, order_types: Vec<OrderType>, pk_indices: Vec<usize>, distribution: TableDistribution, table_option: TableOption, value_indices: Vec<usize>, read_prefix_len_hint: usize, versioned: bool, ) -> Self
source§impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD>
impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD>
pub fn pk_serializer(&self) -> &OrderedRowSerde
pub fn schema(&self) -> &Schema
pub fn pk_indices(&self) -> &[usize]
pub fn output_indices(&self) -> &[usize]
sourcepub fn pk_in_output_indices(&self) -> Option<Vec<usize>>
pub fn pk_in_output_indices(&self) -> Option<Vec<usize>>
Get the indices of the primary key columns in the output columns.
Returns None
if any of the primary key columns is not in the output columns.
pub fn table_id(&self) -> TableId
pub fn vnodes(&self) -> &Arc<Bitmap>
source§impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD>
impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD>
Point get
sourcepub async fn get_row(
&self,
pk: impl Row,
wait_epoch: HummockReadEpoch,
) -> StorageResult<Option<OwnedRow>>
pub async fn get_row( &self, pk: impl Row, wait_epoch: HummockReadEpoch, ) -> StorageResult<Option<OwnedRow>>
Get a single row by point get
source§impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD>
impl<S: StateStore, SD: ValueRowSerde> StorageTableInner<S, SD>
Iterators
sourceasync fn iter_with_encoded_key_range(
&self,
prefix_hint: Option<Bytes>,
encoded_key_range: (Bound<Bytes>, Bound<Bytes>),
wait_epoch: HummockReadEpoch,
vnode_hint: Option<VirtualNode>,
ordered: bool,
prefetch_options: PrefetchOptions,
) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
async fn iter_with_encoded_key_range( &self, prefix_hint: Option<Bytes>, encoded_key_range: (Bound<Bytes>, Bound<Bytes>), wait_epoch: HummockReadEpoch, vnode_hint: Option<VirtualNode>, ordered: bool, prefetch_options: PrefetchOptions, ) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
Get multiple stream item StorageResult<KeyedRow<Bytes>>
based on the specified vnodes of this table with
vnode_hint
, and merge or concat them by given ordered
.
fn serialize_pk_bound( &self, pk_prefix: impl Row, range_bound: Bound<&OwnedRow>, is_start_bound: bool, ) -> Bound<Bytes>
sourceasync fn iter_with_pk_bounds(
&self,
epoch: HummockReadEpoch,
pk_prefix: impl Row,
range_bounds: impl RangeBounds<OwnedRow>,
ordered: bool,
prefetch_options: PrefetchOptions,
) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
async fn iter_with_pk_bounds( &self, epoch: HummockReadEpoch, pk_prefix: impl Row, range_bounds: impl RangeBounds<OwnedRow>, ordered: bool, prefetch_options: PrefetchOptions, ) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
Iterates on the table with the given prefix of the pk in pk_prefix
and the range bounds.
fn convert_row_stream_to_array_vec_stream( iter: impl Stream<Item = StorageResult<KeyedRow<Bytes>>>, schema: Schema, chunk_size: usize, ) -> impl Stream<Item = Result<(Vec<ArrayRef>, usize), StorageError>>
sourceasync fn chunk_iter_with_pk_bounds(
&self,
epoch: HummockReadEpoch,
pk_prefix: impl Row,
range_bounds: impl RangeBounds<OwnedRow>,
ordered: bool,
chunk_size: usize,
prefetch_options: PrefetchOptions,
) -> StorageResult<impl Stream<Item = StorageResult<(Vec<ArrayRef>, usize)>> + Send>
async fn chunk_iter_with_pk_bounds( &self, epoch: HummockReadEpoch, pk_prefix: impl Row, range_bounds: impl RangeBounds<OwnedRow>, ordered: bool, chunk_size: usize, prefetch_options: PrefetchOptions, ) -> StorageResult<impl Stream<Item = StorageResult<(Vec<ArrayRef>, usize)>> + Send>
Iterates on the table with the given prefix of the pk in pk_prefix
and the range bounds.
Returns a stream of chunks of columns with the provided chunk_size
sourcepub async fn batch_iter_with_pk_bounds(
&self,
epoch: HummockReadEpoch,
pk_prefix: impl Row,
range_bounds: impl RangeBounds<OwnedRow>,
ordered: bool,
prefetch_options: PrefetchOptions,
) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
pub async fn batch_iter_with_pk_bounds( &self, epoch: HummockReadEpoch, pk_prefix: impl Row, range_bounds: impl RangeBounds<OwnedRow>, ordered: bool, prefetch_options: PrefetchOptions, ) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
Construct a stream item StorageResult<KeyedRow<Bytes>>
for batch executors.
Differs from the streaming one, this iterator will wait for the epoch before iteration
pub async fn batch_iter( &self, epoch: HummockReadEpoch, ordered: bool, prefetch_options: PrefetchOptions, ) -> StorageResult<impl Stream<Item = StorageResult<KeyedRow<Bytes>>> + Send>
pub async fn batch_iter_log_with_pk_bounds( &self, start_epoch: u64, end_epoch: HummockReadEpoch, ordered: bool, ) -> StorageResult<impl Stream<Item = StorageResult<ChangeLogRow>> + Send + 'static>
sourcepub async fn batch_chunk_iter_with_pk_bounds(
&self,
epoch: HummockReadEpoch,
pk_prefix: impl Row,
range_bounds: impl RangeBounds<OwnedRow>,
ordered: bool,
chunk_size: usize,
prefetch_options: PrefetchOptions,
) -> StorageResult<impl Stream<Item = StorageResult<DataChunk>> + Send>
pub async fn batch_chunk_iter_with_pk_bounds( &self, epoch: HummockReadEpoch, pk_prefix: impl Row, range_bounds: impl RangeBounds<OwnedRow>, ordered: bool, chunk_size: usize, prefetch_options: PrefetchOptions, ) -> StorageResult<impl Stream<Item = StorageResult<DataChunk>> + Send>
Iterates on the table with the given prefix of the pk in pk_prefix
and the range bounds.
Returns a stream of DataChunk
with the provided chunk_size
Trait Implementations§
source§impl<S: Clone + StateStore, SD: Clone + ValueRowSerde> Clone for StorageTableInner<S, SD>
impl<S: Clone + StateStore, SD: Clone + ValueRowSerde> Clone for StorageTableInner<S, SD>
source§fn clone(&self) -> StorageTableInner<S, SD>
fn clone(&self) -> StorageTableInner<S, SD>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<S: StateStore, SD: ValueRowSerde> Debug for StorageTableInner<S, SD>
impl<S: StateStore, SD: ValueRowSerde> Debug for StorageTableInner<S, SD>
Auto Trait Implementations§
impl<S, SD> Freeze for StorageTableInner<S, SD>where
S: Freeze,
impl<S, SD> RefUnwindSafe for StorageTableInner<S, SD>where
S: RefUnwindSafe,
SD: RefUnwindSafe,
impl<S, SD> Send for StorageTableInner<S, SD>
impl<S, SD> Sync for StorageTableInner<S, SD>
impl<S, SD> Unpin for StorageTableInner<S, SD>where
S: Unpin,
impl<S, SD> UnwindSafe for StorageTableInner<S, SD>where
S: UnwindSafe,
SD: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.