Struct re_chunk::helpers::UnitChunkShared
source · pub struct UnitChunkShared(ChunkShared);
Expand description
A ChunkShared
that is guaranteed to always contain a single row’s worth of data.
Tuple Fields§
§0: ChunkShared
Implementations§
pub fn into_chunk(self) -> ChunkShared
sourcepub fn index(&self, timeline: &Timeline) -> Option<(TimeInt, RowId)>
pub fn index(&self, timeline: &Timeline) -> Option<(TimeInt, RowId)>
Returns the index ((TimeInt, RowId)
pair) of the single row within, on the given timeline.
Returns the single static index if the chunk is static.
sourcepub fn row_id(&self) -> Option<RowId>
pub fn row_id(&self) -> Option<RowId>
Returns the RowId
of the single row within, on the given timeline.
Returns the single static RowId
if the chunk is static.
sourcepub fn num_instances(&self, component_name: &ComponentName) -> u64
pub fn num_instances(&self, component_name: &ComponentName) -> u64
Returns the number of instances of the single row within for a given component.
sourcepub fn component_batch_raw(
&self,
component_name: &ComponentName
) -> Option<Box<dyn ArrowArray>>
pub fn component_batch_raw( &self, component_name: &ComponentName ) -> Option<Box<dyn ArrowArray>>
Returns the raw data for the specified component.
sourcepub fn component_batch<C: Component>(&self) -> Option<ChunkResult<Vec<C>>>
pub fn component_batch<C: Component>(&self) -> Option<ChunkResult<Vec<C>>>
Returns the deserialized data for the specified component.
Returns an error if the data cannot be deserialized.
sourcepub fn component_instance_raw(
&self,
component_name: &ComponentName,
instance_index: usize
) -> Option<ChunkResult<Box<dyn ArrowArray>>>
pub fn component_instance_raw( &self, component_name: &ComponentName, instance_index: usize ) -> Option<ChunkResult<Box<dyn ArrowArray>>>
Returns the raw data for the specified component at the given instance index.
Returns an error if the instance index is out of bounds.
sourcepub fn component_instance<C: Component>(
&self,
instance_index: usize
) -> Option<ChunkResult<C>>
pub fn component_instance<C: Component>( &self, instance_index: usize ) -> Option<ChunkResult<C>>
Returns the deserialized data for the specified component at the given instance index.
Returns an error if the data cannot be deserialized, or if the instance index is out of bounds.
sourcepub fn component_mono_raw(
&self,
component_name: &ComponentName
) -> Option<ChunkResult<Box<dyn ArrowArray>>>
pub fn component_mono_raw( &self, component_name: &ComponentName ) -> Option<ChunkResult<Box<dyn ArrowArray>>>
Returns the raw data for the specified component, assuming a mono-batch.
Returns an error if the underlying batch is not of unit length.
sourcepub fn component_mono<C: Component>(&self) -> Option<ChunkResult<C>>
pub fn component_mono<C: Component>(&self) -> Option<ChunkResult<C>>
Returns the deserialized data for the specified component, assuming a mono-batch.
Returns an error if the data cannot be deserialized, or if the underlying batch is not of unit length.
Methods from Deref<Target = Chunk>§
sourcepub fn are_equal_ignoring_extension_types(&self, other: &Self) -> bool
pub fn are_equal_ignoring_extension_types(&self, other: &Self) -> bool
Check for equality while ignoring possible Extension
type information
This is necessary because arrow2
loses the Extension
datatype
when deserializing back from the arrow_schema::DataType
representation.
In theory we could fix this, but as we’re moving away from arrow2 anyways it’s unlikely worth the effort.
sourcepub fn clone_as(&self, id: ChunkId, first_row_id: RowId) -> Self
pub fn clone_as(&self, id: ChunkId, first_row_id: RowId) -> Self
Clones the chunk and assign new IDs to the resulting chunk and its rows.
first_row_id
will become the RowId
of the first row in the duplicated chunk.
Each row after that will be monotonically increasing.
sourcepub fn time_range_per_component(
&self
) -> BTreeMap<Timeline, BTreeMap<ComponentName, ResolvedTimeRange>>
pub fn time_range_per_component( &self ) -> BTreeMap<Timeline, BTreeMap<ComponentName, ResolvedTimeRange>>
Computes the time range covered by each individual component column on each timeline.
This is different from the time range covered by the Chunk
as a whole because component
columns are potentially sparse.
This is crucial for indexing and queries to work properly.
sourcepub fn num_events_cumulative(&self) -> u64
pub fn num_events_cumulative(&self) -> u64
The cumulative number of events in this chunk.
I.e. how many component batches (“cells”) were logged in total?
sourcepub fn num_events_cumulative_per_unique_time(
&self,
timeline: &Timeline
) -> Vec<(TimeInt, u64)>
pub fn num_events_cumulative_per_unique_time( &self, timeline: &Timeline ) -> Vec<(TimeInt, u64)>
The cumulative number of events in this chunk for each unique timestamp.
I.e. how many component batches (“cells”) were logged in total at each timestamp?
Keep in mind that a timestamp can appear multiple times in a Chunk
.
This method will do a sum accumulation to account for these cases (i.e. every timestamp in
the returned vector is guaranteed to be unique).
fn num_events_cumulative_per_unique_time_sorted( &self, time_column: &TimeColumn ) -> Vec<(TimeInt, u64)>
fn num_events_cumulative_per_unique_time_unsorted( &self, time_column: &TimeColumn ) -> Vec<(TimeInt, u64)>
sourcepub fn num_events_for_component(
&self,
component_name: ComponentName
) -> Option<u64>
pub fn num_events_for_component( &self, component_name: ComponentName ) -> Option<u64>
The number of events in this chunk for the specified component.
I.e. how many component batches (“cells”) were logged in total for this component?
sourcepub fn row_id_range_per_component(
&self
) -> BTreeMap<ComponentName, (RowId, RowId)>
pub fn row_id_range_per_component( &self ) -> BTreeMap<ComponentName, (RowId, RowId)>
Computes the RowId
range covered by each individual component column on each timeline.
This is different from the RowId
range covered by the Chunk
as a whole because component
columns are potentially sparse.
This is crucial for indexing and queries to work properly.
pub fn id(&self) -> ChunkId
pub fn entity_path(&self) -> &EntityPath
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
pub fn is_empty(&self) -> bool
pub fn row_ids_array(&self) -> &ArrowStructArray
sourcepub fn row_ids_raw(
&self
) -> (&ArrowPrimitiveArray<u64>, &ArrowPrimitiveArray<u64>)
pub fn row_ids_raw( &self ) -> (&ArrowPrimitiveArray<u64>, &ArrowPrimitiveArray<u64>)
Returns the RowId
s in their raw-est form: a tuple of (times, counters) arrays.
sourcepub fn row_ids(&self) -> impl Iterator<Item = RowId> + '_
pub fn row_ids(&self) -> impl Iterator<Item = RowId> + '_
All the RowId
in this chunk.
This could be in any order if this chunk is unsorted.
sourcepub fn component_row_ids(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = RowId> + '_
pub fn component_row_ids( &self, component_name: &ComponentName ) -> impl Iterator<Item = RowId> + '_
Returns an iterator over the RowId
s of a Chunk
, for a given component.
This is different than Self::row_ids
: it will only yield RowId
s for rows at which
there is data for the specified component_name
.
sourcepub fn row_id_range(&self) -> Option<(RowId, RowId)>
pub fn row_id_range(&self) -> Option<(RowId, RowId)>
pub fn is_static(&self) -> bool
pub fn timelines(&self) -> &BTreeMap<Timeline, TimeColumn>
pub fn component_names(&self) -> impl Iterator<Item = ComponentName> + '_
pub fn components(&self) -> &BTreeMap<ComponentName, ArrowListArray<i32>>
sourcepub fn timepoint_max(&self) -> TimePoint
pub fn timepoint_max(&self) -> TimePoint
Computes the maximum value for each and every timeline present across this entire chunk,
and returns the corresponding [TimePoint
].
sourcepub fn sanity_check(&self) -> ChunkResult<()>
pub fn sanity_check(&self) -> ChunkResult<()>
Returns an error if the Chunk’s invariants are not upheld.
Costly checks are only run in debug builds.
sourcepub fn component_batch_raw(
&self,
component_name: &ComponentName,
row_index: usize
) -> Option<ChunkResult<Box<dyn ArrowArray>>>
pub fn component_batch_raw( &self, component_name: &ComponentName, row_index: usize ) -> Option<ChunkResult<Box<dyn ArrowArray>>>
Returns the raw data for the specified component.
Returns an error if the row index is out of bounds.
sourcepub fn component_batch<C: Component>(
&self,
row_index: usize
) -> Option<ChunkResult<Vec<C>>>
pub fn component_batch<C: Component>( &self, row_index: usize ) -> Option<ChunkResult<Vec<C>>>
Returns the deserialized data for the specified component.
Returns an error if the data cannot be deserialized, or if the row index is out of bounds.
sourcepub fn component_instance_raw(
&self,
component_name: &ComponentName,
row_index: usize,
instance_index: usize
) -> Option<ChunkResult<Box<dyn ArrowArray>>>
pub fn component_instance_raw( &self, component_name: &ComponentName, row_index: usize, instance_index: usize ) -> Option<ChunkResult<Box<dyn ArrowArray>>>
Returns the raw data for the specified component at the given instance index.
Returns an error if either the row index or instance index are out of bounds.
sourcepub fn component_instance<C: Component>(
&self,
row_index: usize,
instance_index: usize
) -> Option<ChunkResult<C>>
pub fn component_instance<C: Component>( &self, row_index: usize, instance_index: usize ) -> Option<ChunkResult<C>>
Returns the component data of the specified instance.
Returns an error if the data cannot be deserialized, or if either the row index or instance index are out of bounds.
sourcepub fn component_mono_raw(
&self,
component_name: &ComponentName,
row_index: usize
) -> Option<ChunkResult<Box<dyn ArrowArray>>>
pub fn component_mono_raw( &self, component_name: &ComponentName, row_index: usize ) -> Option<ChunkResult<Box<dyn ArrowArray>>>
Returns the raw data for the specified component, assuming a mono-batch.
Returns an error if either the row index is out of bounds, or the underlying batch is not of unit length.
sourcepub fn component_mono<C: Component>(
&self,
row_index: usize
) -> Option<ChunkResult<C>>
pub fn component_mono<C: Component>( &self, row_index: usize ) -> Option<ChunkResult<C>>
Returns the deserialized data for the specified component, assuming a mono-batch.
Returns an error if the data cannot be deserialized, or if either the row index is out of bounds, or the underlying batch is not of unit length.
sourcepub fn to_unit(self: &ChunkShared) -> Option<UnitChunkShared>
pub fn to_unit(self: &ChunkShared) -> Option<UnitChunkShared>
Turns the chunk into a UnitChunkShared
, if possible.
sourcepub fn iter_indices(
&self,
timeline: &Timeline
) -> impl Iterator<Item = (TimeInt, RowId)> + '_
pub fn iter_indices( &self, timeline: &Timeline ) -> impl Iterator<Item = (TimeInt, RowId)> + '_
Returns an iterator over the indices ((TimeInt, RowId)
) of a Chunk
, for a given timeline.
If the chunk is static, timeline
will be ignored.
See also:
sourcepub fn iter_component_indices(
&self,
timeline: &Timeline,
component_name: &ComponentName
) -> impl Iterator<Item = (TimeInt, RowId)> + '_
pub fn iter_component_indices( &self, timeline: &Timeline, component_name: &ComponentName ) -> impl Iterator<Item = (TimeInt, RowId)> + '_
Returns an iterator over the indices ((TimeInt, RowId)
) of a Chunk
, for a given
timeline and component.
If the chunk is static, timeline
will be ignored.
This is different than Self::iter_indices
in that it will only yield indices for rows
at which there is data for the specified component_name
.
See also Self::iter_indices
.
sourcepub fn iter_timepoints(&self) -> impl Iterator<Item = TimePoint> + '_
pub fn iter_timepoints(&self) -> impl Iterator<Item = TimePoint> + '_
sourcepub fn iter_component_timepoints(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = TimePoint> + '_
pub fn iter_component_timepoints( &self, component_name: &ComponentName ) -> impl Iterator<Item = TimePoint> + '_
Returns an iterator over the [TimePoint
]s of a Chunk
, for a given component.
This is different than Self::iter_timepoints
in that it will only yield timepoints for rows
at which there is data for the specified component_name
.
See also Self::iter_timepoints
.
sourcepub fn iter_component_offsets(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = (usize, usize)> + '_
pub fn iter_component_offsets( &self, component_name: &ComponentName ) -> impl Iterator<Item = (usize, usize)> + '_
Returns an iterator over the offsets ((offset, len)
) of a Chunk
, for a given
component.
I.e. each (offset, len)
pair describes the position of a component batch in the
underlying arrow array of values.
sourcepub fn iter_component_arrays(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = Box<dyn ArrowArray>> + '_
pub fn iter_component_arrays( &self, component_name: &ComponentName ) -> impl Iterator<Item = Box<dyn ArrowArray>> + '_
Returns an iterator over the raw arrays of a Chunk
, for a given component.
See also:
sourcepub fn iter_primitive<T: NativeType>(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = &[T]> + '_
pub fn iter_primitive<T: NativeType>( &self, component_name: &ComponentName ) -> impl Iterator<Item = &[T]> + '_
Returns an iterator over the raw primitive values of a Chunk
, for a given component.
This is a very fast path: the entire column will be downcasted at once, and then every component batch will be a slice reference into that global slice. Use this when working with simple arrow datatypes and performance matters (e.g. scalars, points, etc).
See also:
sourcepub fn iter_primitive_array<const N: usize, T: NativeType>(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = &[[T; N]]> + '_where
[T; N]: Pod,
pub fn iter_primitive_array<const N: usize, T: NativeType>(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = &[[T; N]]> + '_where
[T; N]: Pod,
Returns an iterator over the raw primitive arrays of a Chunk
, for a given component.
This is a very fast path: the entire column will be downcasted at once, and then every component batch will be a slice reference into that global slice. Use this when working with simple arrow datatypes and performance matters (e.g. scalars, points, etc).
See also:
sourcepub fn iter_primitive_array_list<const N: usize, T: NativeType>(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = Vec<&[[T; N]]>> + '_where
[T; N]: Pod,
pub fn iter_primitive_array_list<const N: usize, T: NativeType>(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = Vec<&[[T; N]]>> + '_where
[T; N]: Pod,
Returns an iterator over the raw list of primitive arrays of a Chunk
, for a given component.
This is a very fast path: the entire column will be downcasted at once, and then every component batch will be a slice reference into that global slice. Use this when working with simple arrow datatypes and performance matters (e.g. strips, etc).
See also:
sourcepub fn iter_string(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = Vec<ArrowString>> + '_
pub fn iter_string( &self, component_name: &ComponentName ) -> impl Iterator<Item = Vec<ArrowString>> + '_
Returns an iterator over the raw strings of a Chunk
, for a given component.
This is a very fast path: the entire column will be downcasted at once, and then every component batch will be a slice reference into that global slice. Use this when working with simple arrow datatypes and performance matters (e.g. labels, etc).
See also:
sourcepub fn iter_buffer<T: NativeType>(
&self,
component_name: &ComponentName
) -> impl Iterator<Item = Vec<ArrowBuffer<T>>> + '_
pub fn iter_buffer<T: NativeType>( &self, component_name: &ComponentName ) -> impl Iterator<Item = Vec<ArrowBuffer<T>>> + '_
Returns an iterator over the raw buffers of a Chunk
, for a given component.
This is a very fast path: the entire column will be downcasted at once, and then every component batch will be a slice reference into that global slice. Use this when working with simple arrow datatypes and performance matters (e.g. blobs, etc).
See also:
sourcepub fn iter_indices_owned(
self: Arc<Self>,
timeline: &Timeline
) -> impl Iterator<Item = (TimeInt, RowId)>
pub fn iter_indices_owned( self: Arc<Self>, timeline: &Timeline ) -> impl Iterator<Item = (TimeInt, RowId)>
Returns an iterator over the indices ((TimeInt, RowId)
) of a Chunk
, for a given timeline.
If the chunk is static, timeline
will be ignored.
The returned iterator outlives self
, thus it can be passed around freely.
The tradeoff is that self
must be an Arc
.
See also Self::iter_indices
.
sourcepub fn iter_component<C: Component>(
&self
) -> ChunkComponentIter<C, impl Iterator<Item = (usize, usize)> + '_> ⓘ
pub fn iter_component<C: Component>( &self ) -> ChunkComponentIter<C, impl Iterator<Item = (usize, usize)> + '_> ⓘ
Returns an iterator over the deserialized batches of a Chunk
, for a given component.
This is a dedicated fast path: the entire column will be downcasted and deserialized at once, and then every component batch will be a slice reference into that global slice. Use this when working with complex arrow datatypes and performance matters (e.g. ranging through enum types across many timestamps).
See also:
sourcepub fn latest_at(
&self,
query: &LatestAtQuery,
component_name: ComponentName
) -> Self
pub fn latest_at( &self, query: &LatestAtQuery, component_name: ComponentName ) -> Self
Runs a LatestAtQuery
filter on a Chunk
.
This behaves as a row-based filter: the result is a new Chunk
that is vertically
sliced to only contain the row relevant for the specified query
.
The resulting Chunk
is guaranteed to contain all the same columns has the queried
chunk: there is no horizontal slicing going on.
An empty Chunk
(i.e. 0 rows, but N columns) is returned if the query
yields nothing.
Because the resulting chunk doesn’t discard any column information, you can find extra relevant
information by inspecting the data, for examples timestamps on other timelines.
See Self::timeline_sliced
and Self::component_sliced
if you do want to filter this
extra data.
sourcepub fn concatenated(&self, rhs: &Self) -> ChunkResult<Self>
pub fn concatenated(&self, rhs: &Self) -> ChunkResult<Self>
Concatenates two Chunk
s into a new one.
The order of the arguments matter: self
‘s contents will precede rhs
’ contents in the
returned Chunk
.
This will return an error if the chunks are not concatenable.
sourcepub fn overlaps_on_row_id(&self, rhs: &Self) -> bool
pub fn overlaps_on_row_id(&self, rhs: &Self) -> bool
Returns true
if self
and rhs
overlap on their RowId
range.
sourcepub fn overlaps_on_time(&self, rhs: &Self) -> bool
pub fn overlaps_on_time(&self, rhs: &Self) -> bool
Returns true
if self
and rhs
overlap on any of their time range(s).
This does not imply that they share the same exact set of timelines.
sourcepub fn same_entity_paths(&self, rhs: &Self) -> bool
pub fn same_entity_paths(&self, rhs: &Self) -> bool
Returns true
if both chunks share the same entity path.
sourcepub fn same_timelines(&self, rhs: &Self) -> bool
pub fn same_timelines(&self, rhs: &Self) -> bool
Returns true
if both chunks contains the same set of timelines.
sourcepub fn same_datatypes(&self, rhs: &Self) -> bool
pub fn same_datatypes(&self, rhs: &Self) -> bool
Returns true
if both chunks share the same datatypes for the components that
they have in common.
sourcepub fn concatenable(&self, rhs: &Self) -> bool
pub fn concatenable(&self, rhs: &Self) -> bool
Returns true if two chunks are concatenable.
To be concatenable, two chunks must:
- Share the same entity path.
- Share the same exact set of timelines.
- Use the same datatypes for the components they have in common.
sourcepub fn range(&self, query: &RangeQuery, component_name: ComponentName) -> Self
pub fn range(&self, query: &RangeQuery, component_name: ComponentName) -> Self
Runs a RangeQuery
filter on a Chunk
.
This behaves as a row-based filter: the result is a new Chunk
that is vertically
sliced, sorted and filtered in order to only contain the row(s) relevant for the
specified query
.
The resulting Chunk
is guaranteed to contain all the same columns has the queried
chunk: there is no horizontal slicing going on.
An empty Chunk
(i.e. 0 rows, but N columns) is returned if the query
yields nothing.
Because the resulting chunk doesn’t discard any column information, you can find extra relevant
information by inspecting the data, for examples timestamps on other timelines.
See Self::timeline_sliced
and Self::component_sliced
if you do want to filter this
extra data.
sourcepub fn is_sorted(&self) -> bool
pub fn is_sorted(&self) -> bool
Is the chunk currently ascendingly sorted by crate::RowId
?
This is O(1) (cached).
See also Self::is_sorted_uncached
.
sourcepub fn is_time_sorted(&self) -> bool
pub fn is_time_sorted(&self) -> bool
Is the chunk ascendingly sorted by time, for all of its timelines?
This is O(1) (cached).
sourcepub fn is_timeline_sorted(&self, timeline: &Timeline) -> bool
pub fn is_timeline_sorted(&self, timeline: &Timeline) -> bool
Is the chunk ascendingly sorted by time, for a specific timeline?
This is O(1) (cached).
See also Self::is_timeline_sorted_uncached
.
sourcepub fn sorted_by_timeline_if_unsorted(&self, timeline: &Timeline) -> Self
pub fn sorted_by_timeline_if_unsorted(&self, timeline: &Timeline) -> Self
Returns a new Chunk
that is sorted by (<timeline>, RowId)
.
The underlying arrow data will be copied and shuffled in memory in order to make it contiguous.
This is a no-op if the underlying timeline is already sorted appropriately (happy path).
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn cell(
&self,
row_id: RowId,
component_name: &ComponentName
) -> Option<Box<dyn ArrowArray>>
pub fn cell( &self, row_id: RowId, component_name: &ComponentName ) -> Option<Box<dyn ArrowArray>>
Returns the cell corresponding to the specified RowId
for a given [ComponentName
].
This is O(log(n))
if self.is_sorted()
, and O(n)
otherwise.
Reminder: duplicated RowId
s results in undefined behavior.
sourcepub fn row_sliced(&self, index: usize, len: usize) -> Self
pub fn row_sliced(&self, index: usize, len: usize) -> Self
Slices the Chunk
vertically.
The result is a new Chunk
with the same columns and (potentially) less rows.
This cannot fail nor panic: index
and len
will be capped so that they cannot
run out of bounds.
This can result in an empty Chunk
being returned if the slice is completely OOB.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn timeline_sliced(&self, timeline: Timeline) -> Self
pub fn timeline_sliced(&self, timeline: Timeline) -> Self
Slices the Chunk
horizontally by keeping only the selected timeline
.
The result is a new Chunk
with the same rows and (at-most) one timeline column.
All non-timeline columns will be kept as-is.
If timeline
is not found within the Chunk
, the end result will be the same as the
current chunk but without any timeline column.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn component_sliced(&self, component_name: ComponentName) -> Self
pub fn component_sliced(&self, component_name: ComponentName) -> Self
Slices the Chunk
horizontally by keeping only the selected component_name
.
The result is a new Chunk
with the same rows and (at-most) one component column.
All non-component columns will be kept as-is.
If component_name
is not found within the Chunk
, the end result will be the same as the
current chunk but without any component column.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn timelines_sliced(&self, timelines_to_keep: &IntSet<Timeline>) -> Self
pub fn timelines_sliced(&self, timelines_to_keep: &IntSet<Timeline>) -> Self
Slices the Chunk
horizontally by keeping only the selected timelines.
The result is a new Chunk
with the same rows and (at-most) the selected timeline columns.
All non-timeline columns will be kept as-is.
If none of the selected timelines exist in the Chunk
, the end result will be the same as the
current chunk but without any timeline column.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn components_sliced(&self, component_names: &IntSet<ComponentName>) -> Self
pub fn components_sliced(&self, component_names: &IntSet<ComponentName>) -> Self
Slices the Chunk
horizontally by keeping only the selected component_names
.
The result is a new Chunk
with the same rows and (at-most) the selected component columns.
All non-component columns will be kept as-is.
If none of the component_names
exist in the Chunk
, the end result will be the same as the
current chunk but without any component column.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn densified(&self, component_name_pov: ComponentName) -> Self
pub fn densified(&self, component_name_pov: ComponentName) -> Self
Densifies the Chunk
vertically based on the component_name
column.
Densifying here means dropping all rows where the associated value in the component_name
column is null.
The result is a new Chunk
where the component_name
column is guaranteed to be dense.
If component_name
doesn’t exist in this Chunk
, or if it is already dense, this method
is a no-op.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn emptied(&self) -> Self
pub fn emptied(&self) -> Self
Empties the Chunk
vertically.
The result is a new Chunk
with the same columns but zero rows.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn deduped_latest_on_index(&self, index: &Timeline) -> Self
pub fn deduped_latest_on_index(&self, index: &Timeline) -> Self
Removes duplicate rows from sections of consecutive identical indices.
- If the
Chunk
is sorted on that index, the remaining values in the index column will be unique. - If the
Chunk
has been densified on a specific column, the resulting chunk will effectively contain the latest value of that column for each given index value.
If this is a temporal chunk and timeline
isn’t present in it, this method is a no-op.
This does not obey RowId
-ordering semantics (or any other kind of semantics for that
matter) – it merely respects how the chunk is currently laid out: no more, no less.
Sort the chunk according to the semantics you’re looking for before calling this method.
sourcepub fn filtered(&self, filter: &ArrowBooleanArray) -> Option<Self>
pub fn filtered(&self, filter: &ArrowBooleanArray) -> Option<Self>
Applies a filter kernel to the Chunk
as a whole.
Returns None
if the length of the filter does not match the number of rows in the chunk.
In release builds, filters are allowed to have null entries (they will be interpreted as false
).
In debug builds, null entries will panic.
Note: a filter
kernel copies the data in order to make the resulting arrays contiguous in memory.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn taken<O: Index>(&self, indices: &ArrowPrimitiveArray<O>) -> Self
pub fn taken<O: Index>(&self, indices: &ArrowPrimitiveArray<O>) -> Self
Applies a take kernel to the Chunk
as a whole.
In release builds, indices are allowed to have null entries (they will be taken as null
s).
In debug builds, null entries will panic.
Note: a take
kernel copies the data in order to make the resulting arrays contiguous in memory.
Takes care of up- and down-casting the data back and forth on behalf of the caller.
WARNING: the returned chunk has the same old crate::ChunkId
! Change it with Self::with_id
.
sourcepub fn to_transport(&self) -> ChunkResult<TransportChunk>
pub fn to_transport(&self) -> ChunkResult<TransportChunk>
Prepare the Chunk
for transport.
It is probably a good idea to sort the chunk first.
pub fn to_arrow_msg(&self) -> ChunkResult<ArrowMsg>
Trait Implementations§
source§fn clone(&self) -> UnitChunkShared
fn clone(&self) -> UnitChunkShared
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreAuto Trait Implementations§
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