Struct re_chunk::TransportChunk
source · pub struct TransportChunk {
pub schema: Schema,
pub data: Chunk<Box<dyn ArrowArray>>,
}
Expand description
A Chunk
that is ready for transport. Obtained by calling Chunk::to_transport
.
Implemented as an Arrow dataframe: a schema and a batch.
Use the Display
implementation to dump the chunk as a nicely formatted table.
This has a stable ABI! The entire point of this type is to allow users to send raw arrow data into Rerun. This means we have to be very careful when checking the validity of the data: slipping corrupt data into the store could silently break all the index search logic (e.g. think of a chunk claiming to be sorted while it is in fact not).
Fields§
§schema: Schema
The schema of the dataframe, and all chunk-level and field-level metadata.
Take a look at the TransportChunk::CHUNK_METADATA_*
and TransportChunk::FIELD_METADATA_*
constants for more information about available metadata.
data: Chunk<Box<dyn ArrowArray>>
All the control, time and component data.
Implementations§
source§impl TransportChunk
impl TransportChunk
sourcepub const CHUNK_METADATA_KEY_ID: &'static str = "rerun.id"
pub const CHUNK_METADATA_KEY_ID: &'static str = "rerun.id"
The key used to identify a Rerun ChunkId
in chunk-level [ArrowSchema
] metadata.
sourcepub const CHUNK_METADATA_KEY_ENTITY_PATH: &'static str = "rerun.entity_path"
pub const CHUNK_METADATA_KEY_ENTITY_PATH: &'static str = "rerun.entity_path"
The key used to identify a Rerun [EntityPath
] in chunk-level [ArrowSchema
] metadata.
sourcepub const CHUNK_METADATA_KEY_HEAP_SIZE_BYTES: &'static str = "rerun.heap_size_bytes"
pub const CHUNK_METADATA_KEY_HEAP_SIZE_BYTES: &'static str = "rerun.heap_size_bytes"
The key used to identify the size in bytes of the data, once loaded in memory, in chunk-level
[ArrowSchema
] metadata.
sourcepub const CHUNK_METADATA_MARKER_IS_SORTED_BY_ROW_ID: &'static str = "rerun.is_sorted"
pub const CHUNK_METADATA_MARKER_IS_SORTED_BY_ROW_ID: &'static str = "rerun.is_sorted"
The marker used to identify whether a chunk is sorted in chunk-level [ArrowSchema
] metadata.
The associated value is irrelevant – if this marker is present, then it is true.
Chunks are ascendingly sorted by their RowId
column.
sourcepub const FIELD_METADATA_KEY_KIND: &'static str = "rerun.kind"
pub const FIELD_METADATA_KEY_KIND: &'static str = "rerun.kind"
The key used to identify the kind of a Rerun column in field-level [ArrowSchema
] metadata.
That is: control columns (e.g. row_id
), time columns or component columns.
sourcepub const FIELD_METADATA_VALUE_KIND_TIME: &'static str = "time"
pub const FIELD_METADATA_VALUE_KIND_TIME: &'static str = "time"
The value used to identify a Rerun time column in field-level [ArrowSchema
] metadata.
sourcepub const FIELD_METADATA_VALUE_KIND_CONTROL: &'static str = "control"
pub const FIELD_METADATA_VALUE_KIND_CONTROL: &'static str = "control"
The value used to identify a Rerun control column in field-level [ArrowSchema
] metadata.
sourcepub const FIELD_METADATA_VALUE_KIND_DATA: &'static str = "data"
pub const FIELD_METADATA_VALUE_KIND_DATA: &'static str = "data"
The value used to identify a Rerun data column in field-level [ArrowSchema
] metadata.
sourcepub const FIELD_METADATA_MARKER_IS_SORTED_BY_TIME: &'static str = Self::CHUNK_METADATA_MARKER_IS_SORTED_BY_ROW_ID
pub const FIELD_METADATA_MARKER_IS_SORTED_BY_TIME: &'static str = Self::CHUNK_METADATA_MARKER_IS_SORTED_BY_ROW_ID
The marker used to identify whether a column is sorted in field-level [ArrowSchema
] metadata.
The associated value is irrelevant – if this marker is present, then it is true.
Chunks are ascendingly sorted by their RowId
column but, depending on whether the data
was logged out of order or not for a given time column, that column might follow the global
RowId
while still being unsorted relative to its own time order.
sourcepub fn chunk_metadata_id(id: ChunkId) -> ArrowMetadata
pub fn chunk_metadata_id(id: ChunkId) -> ArrowMetadata
Returns the appropriate chunk-level [ArrowSchema
] metadata for a Rerun ChunkId
.
sourcepub fn chunk_metadata_heap_size_bytes(heap_size_bytes: u64) -> ArrowMetadata
pub fn chunk_metadata_heap_size_bytes(heap_size_bytes: u64) -> ArrowMetadata
Returns the appropriate chunk-level [ArrowSchema
] metadata for the in-memory size in bytes.
sourcepub fn chunk_metadata_entity_path(entity_path: &EntityPath) -> ArrowMetadata
pub fn chunk_metadata_entity_path(entity_path: &EntityPath) -> ArrowMetadata
Returns the appropriate chunk-level [ArrowSchema
] metadata for a Rerun [EntityPath
].
sourcepub fn chunk_metadata_is_sorted() -> ArrowMetadata
pub fn chunk_metadata_is_sorted() -> ArrowMetadata
Returns the appropriate chunk-level [ArrowSchema
] metadata for an IS_SORTED
marker.
sourcepub fn field_metadata_time_column() -> ArrowMetadata
pub fn field_metadata_time_column() -> ArrowMetadata
Returns the appropriate field-level [ArrowSchema
] metadata for a Rerun time column.
sourcepub fn field_metadata_control_column() -> ArrowMetadata
pub fn field_metadata_control_column() -> ArrowMetadata
Returns the appropriate field-level [ArrowSchema
] metadata for a Rerun control column.
sourcepub fn field_metadata_data_column() -> ArrowMetadata
pub fn field_metadata_data_column() -> ArrowMetadata
Returns the appropriate field-level [ArrowSchema
] metadata for a Rerun data column.
sourcepub fn field_metadata_is_sorted() -> ArrowMetadata
pub fn field_metadata_is_sorted() -> ArrowMetadata
Returns the appropriate field-level [ArrowSchema
] metadata for an IS_SORTED
marker.
source§impl TransportChunk
impl TransportChunk
pub fn id(&self) -> ChunkResult<ChunkId>
pub fn entity_path(&self) -> ChunkResult<EntityPath>
pub fn heap_size_bytes(&self) -> Option<u64>
sourcepub fn is_sorted(&self) -> bool
pub fn is_sorted(&self) -> bool
Looks in the chunk metadata for the IS_SORTED
marker.
It is possible that a chunk is sorted but didn’t set that marker. This is fine, although wasteful.
sourcepub fn columns<'a>(
&'a self,
kind: &'a str
) -> impl Iterator<Item = (&ArrowField, &'a Box<dyn ArrowArray>)> + 'a
pub fn columns<'a>( &'a self, kind: &'a str ) -> impl Iterator<Item = (&ArrowField, &'a Box<dyn ArrowArray>)> + 'a
Iterates all columns of the specified kind
.
See:
pub fn all_columns( &self ) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)> + '_
sourcepub fn controls(
&self
) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)>
pub fn controls( &self ) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)>
Iterates all control columns present in this chunk.
sourcepub fn components(
&self
) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)>
pub fn components( &self ) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)>
Iterates all data columns present in this chunk.
sourcepub fn timelines(
&self
) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)>
pub fn timelines( &self ) -> impl Iterator<Item = (&ArrowField, &Box<dyn ArrowArray>)>
Iterates all timeline columns present in this chunk.
sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
How many columns in total? Includes control, time, and component columns.
pub fn num_controls(&self) -> usize
pub fn num_timelines(&self) -> usize
pub fn num_components(&self) -> usize
pub fn num_rows(&self) -> usize
source§impl TransportChunk
impl TransportChunk
sourcepub fn try_to_arrow_record_batch(&self) -> Result<RecordBatch, ArrowError>
pub fn try_to_arrow_record_batch(&self) -> Result<RecordBatch, ArrowError>
Create an arrow-rs [RecordBatch
] containing the data from this TransportChunk
.
This is a “fairly” cheap operation, as it does not copy the underlying arrow data, but does incur overhead of generating an alternative representation of the arrow- related rust structures that refer to those data buffers.
sourcepub fn from_arrow_record_batch(batch: &RecordBatch) -> Self
pub fn from_arrow_record_batch(batch: &RecordBatch) -> Self
Create a TransportChunk
from an arrow-rs [RecordBatch
].
This is a “fairly” cheap operation, as it does not copy the underlying arrow data, but does incur overhead of generating an alternative representation of the arrow- related rust structures that refer to those data buffers.
Trait Implementations§
source§impl Clone for TransportChunk
impl Clone for TransportChunk
source§fn clone(&self) -> TransportChunk
fn clone(&self) -> TransportChunk
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TransportChunk
impl Debug for TransportChunk
Auto Trait Implementations§
impl Freeze for TransportChunk
impl !RefUnwindSafe for TransportChunk
impl Send for TransportChunk
impl Sync for TransportChunk
impl Unpin for TransportChunk
impl !UnwindSafe for TransportChunk
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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§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> 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> 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 more