pub struct EventBatch { /* private fields */ }Expand description
Immutable columnar batch of events sharing one schema.
Implementations§
Source§impl EventBatch
impl EventBatch
Sourcepub fn new(
schema: Arc<Schema>,
p4s: Vec<Arc<[RealVec4]>>,
scalars: Vec<Arc<[f64]>>,
weights: Option<Arc<[f64]>>,
) -> LadduDataResult<Self>
pub fn new( schema: Arc<Schema>, p4s: Vec<Arc<[RealVec4]>>, scalars: Vec<Arc<[f64]>>, weights: Option<Arc<[f64]>>, ) -> LadduDataResult<Self>
Validates column counts and lengths and constructs a batch.
§Errors
Returns LadduDataError when column counts do not match schema or
column and weight lengths are inconsistent.
Sourcepub fn from_events<I>(schema: Arc<Schema>, events: I) -> LadduDataResult<Self>where
I: IntoIterator<Item = OwnedEvent>,
pub fn from_events<I>(schema: Arc<Schema>, events: I) -> LadduDataResult<Self>where
I: IntoIterator<Item = OwnedEvent>,
Collects owned row events into a columnar batch.
§Errors
Returns LadduDataError when an event has the wrong number of values
or weighted and unweighted events are mixed.
Sourcepub fn bytes_per_event(&self) -> usize
pub fn bytes_per_event(&self) -> usize
Returns the logical payload bytes per event represented by this batch.
Sourcepub fn resident_bytes(&self) -> usize
pub fn resident_bytes(&self) -> usize
Returns the retained column payload size in bytes.
Shared schema metadata, allocation headers, and other owners of shared columns are not included.
Sourcepub fn vec4_column(&self, index: usize) -> &[RealVec4]
pub fn vec4_column(&self, index: usize) -> &[RealVec4]
Returns a four-momentum column by index.
Sourcepub fn scalar_column(&self, index: usize) -> &[f64]
pub fn scalar_column(&self, index: usize) -> &[f64]
Returns a scalar column by index.
Sourcepub fn weights_column(&self) -> Option<&[f64]>
pub fn weights_column(&self) -> Option<&[f64]>
Returns the optional explicit weight column.
Sourcepub fn vec4_column_named(&self, name: &str) -> Option<&[RealVec4]>
pub fn vec4_column_named(&self, name: &str) -> Option<&[RealVec4]>
Returns a four-momentum column by logical name.
Sourcepub fn scalar_column_named(&self, name: &str) -> Option<&[f64]>
pub fn scalar_column_named(&self, name: &str) -> Option<&[f64]>
Returns a scalar column by logical name.
Sourcepub fn weights_at(&self, row: usize) -> f64
pub fn weights_at(&self, row: usize) -> f64
Returns the explicit row weight, or one when weights are absent.
Sourcepub fn event(&self, row: usize) -> BatchEvent<'_>
pub fn event(&self, row: usize) -> BatchEvent<'_>
Returns a borrowed view of one row.
Sourcepub fn iter(&self) -> impl Iterator<Item = BatchEvent<'_>>
pub fn iter(&self) -> impl Iterator<Item = BatchEvent<'_>>
Iterates over borrowed event views.
Sourcepub fn select(&self, rows: &[usize]) -> Self
pub fn select(&self, rows: &[usize]) -> Self
Copies selected rows into a new batch in the requested order.
Sourcepub fn reweight<F>(&self, f: F) -> Self
pub fn reweight<F>(&self, f: F) -> Self
Returns a batch sharing value columns with newly computed weights.
Sourcepub fn slice(&self, start: usize, end: usize) -> Self
pub fn slice(&self, start: usize, end: usize) -> Self
Copies the half-open row range start..end into a new batch.
§Panics
Panics when start > end or end exceeds the batch length.
Sourcepub fn concat(batches: &[Self]) -> LadduDataResult<Self>
pub fn concat(batches: &[Self]) -> LadduDataResult<Self>
Concatenates schema-compatible batches.
§Errors
Returns LadduDataError when batches is empty or contains
incompatible schemas.
Trait Implementations§
Source§impl Clone for EventBatch
impl Clone for EventBatch
Source§fn clone(&self) -> EventBatch
fn clone(&self) -> EventBatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EventBatch
impl RefUnwindSafe for EventBatch
impl Send for EventBatch
impl Sync for EventBatch
impl Unpin for EventBatch
impl UnsafeUnpin for EventBatch
impl UnwindSafe for EventBatch
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.