Struct re_chunk::chunk::TimeColumn
source · pub struct TimeColumn {
pub(crate) timeline: Timeline,
pub(crate) times: PrimitiveArray<i64>,
pub(crate) is_sorted: bool,
pub(crate) time_range: ResolvedTimeRange,
}
Fields§
§timeline: Timeline
§times: PrimitiveArray<i64>
Every single timestamp for this timeline.
- This might or might not be sorted, depending on how the data was logged.
- This is guaranteed to always be dense, because chunks are split anytime a timeline is added or removed.
- This cannot ever contain
TimeInt::STATIC
, since static data doesn’t even have timelines.
is_sorted: bool
Is Self::times
sorted?
This is completely independent of Chunk::is_sorted
: a timeline doesn’t necessarily
follow the global RowId
-based order, although it does in most cases (happy path).
time_range: ResolvedTimeRange
The time range covered by Self::times
.
Not necessarily contiguous! Just the min and max value found in Self::times
.
Implementations§
source§impl TimeColumn
impl TimeColumn
sourcepub fn builder(timeline: Timeline) -> TimeColumnBuilder
pub fn builder(timeline: Timeline) -> TimeColumnBuilder
Initializes a new TimeColumnBuilder
.
source§impl TimeColumn
impl TimeColumn
sourcepub fn new(
is_sorted: Option<bool>,
timeline: Timeline,
times: ArrowPrimitiveArray<i64>
) -> Self
pub fn new( is_sorted: Option<bool>, timeline: Timeline, times: ArrowPrimitiveArray<i64> ) -> Self
Creates a new TimeColumn
.
Iff you know for sure whether the data is already appropriately sorted or not, specify is_sorted
.
When left unspecified (None
), it will be computed in O(n) time.
For a row-oriented constructor, see Self::builder
.
sourcepub fn new_sequence(
name: impl Into<TimelineName>,
times: impl IntoIterator<Item = impl Into<i64>>
) -> Self
pub fn new_sequence( name: impl Into<TimelineName>, times: impl IntoIterator<Item = impl Into<i64>> ) -> Self
Creates a new TimeColumn
of sequence type.
sourcepub fn new_seconds(
name: impl Into<TimelineName>,
times: impl IntoIterator<Item = impl Into<f64>>
) -> Self
pub fn new_seconds( name: impl Into<TimelineName>, times: impl IntoIterator<Item = impl Into<f64>> ) -> Self
Creates a new TimeColumn
of sequence type.
sourcepub fn new_nanos(
name: impl Into<TimelineName>,
times: impl IntoIterator<Item = impl Into<i64>>
) -> Self
pub fn new_nanos( name: impl Into<TimelineName>, times: impl IntoIterator<Item = impl Into<i64>> ) -> Self
Creates a new TimeColumn
of nanoseconds type.
source§impl TimeColumn
impl TimeColumn
pub fn timeline(&self) -> &Timeline
pub fn name(&self) -> &str
pub fn time_range(&self) -> ResolvedTimeRange
pub fn times_array(&self) -> &ArrowPrimitiveArray<i64>
pub fn times_raw(&self) -> &[i64]
pub fn times(&self) -> impl DoubleEndedIterator<Item = TimeInt> + '_
pub fn num_rows(&self) -> usize
pub fn is_empty(&self) -> bool
sourcepub fn time_range_per_component(
&self,
components: &BTreeMap<ComponentName, ArrowListArray<i32>>
) -> BTreeMap<ComponentName, ResolvedTimeRange>
pub fn time_range_per_component( &self, components: &BTreeMap<ComponentName, ArrowListArray<i32>> ) -> BTreeMap<ComponentName, ResolvedTimeRange>
Computes the time range covered by each individual component column.
This is different from the time range covered by the TimeColumn
as a whole
because component columns are potentially sparse.
This is crucial for indexing and queries to work properly.
source§impl TimeColumn
impl TimeColumn
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.
source§impl TimeColumn
impl TimeColumn
sourcepub fn concatenated(&self, rhs: &Self) -> Option<Self>
pub fn concatenated(&self, rhs: &Self) -> Option<Self>
Concatenates two TimeColumn
s into a new one.
The order of the arguments matter: self
‘s contents will precede rhs
’ contents in the
returned TimeColumn
.
This will return None
if the time chunks do not share the same timeline.
source§impl TimeColumn
impl TimeColumn
sourcepub fn is_sorted_uncached(&self) -> bool
pub fn is_sorted_uncached(&self) -> bool
Like Self::is_sorted
, but actually checks the entire dataset rather than relying on the
cached value.
O(n). Useful for tests/debugging, or when you just don’t know.
See also Self::is_sorted
.
source§impl TimeColumn
impl TimeColumn
sourcepub fn row_sliced(&self, index: usize, len: usize) -> Self
pub fn row_sliced(&self, index: usize, len: usize) -> Self
Slices the TimeColumn
vertically.
The result is a new TimeColumn
with the same timelines 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 TimeColumn
being returned if the slice is completely OOB.
sourcepub fn emptied(&self) -> Self
pub fn emptied(&self) -> Self
Empties the TimeColumn
vertically.
The result is a new TimeColumn
with the same columns but zero rows.
Trait Implementations§
source§impl Clone for TimeColumn
impl Clone for TimeColumn
source§fn clone(&self) -> TimeColumn
fn clone(&self) -> TimeColumn
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TimeColumn
impl Debug for TimeColumn
source§impl PartialEq for TimeColumn
impl PartialEq for TimeColumn
source§fn eq(&self, other: &TimeColumn) -> bool
fn eq(&self, other: &TimeColumn) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SizeBytes for TimeColumn
impl SizeBytes for TimeColumn
source§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 moreimpl StructuralPartialEq for TimeColumn
Auto Trait Implementations§
impl Freeze for TimeColumn
impl RefUnwindSafe for TimeColumn
impl Send for TimeColumn
impl Sync for TimeColumn
impl Unpin for TimeColumn
impl UnwindSafe for TimeColumn
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