Skip to main content

EventBatch

Struct EventBatch 

Source
pub struct EventBatch { /* private fields */ }
Expand description

Immutable columnar batch of events sharing one schema.

Implementations§

Source§

impl EventBatch

Source

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.

Source

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.

Source

pub fn schema(&self) -> &Arc<Schema>

Returns the shared logical schema.

Source

pub fn len(&self) -> usize

Returns the number of rows.

Source

pub fn bytes_per_event(&self) -> usize

Returns the logical payload bytes per event represented by this batch.

Source

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.

Source

pub fn is_empty(&self) -> bool

Returns whether the batch contains no rows.

Source

pub fn vec4_column(&self, index: usize) -> &[RealVec4]

Returns a four-momentum column by index.

Source

pub fn scalar_column(&self, index: usize) -> &[f64]

Returns a scalar column by index.

Source

pub fn weights_column(&self) -> Option<&[f64]>

Returns the optional explicit weight column.

Source

pub fn vec4_column_named(&self, name: &str) -> Option<&[RealVec4]>

Returns a four-momentum column by logical name.

Source

pub fn scalar_column_named(&self, name: &str) -> Option<&[f64]>

Returns a scalar column by logical name.

Source

pub fn p4_at(&self, col: usize, row: usize) -> RealVec4

Returns one four-momentum cell.

Source

pub fn scalar_at(&self, col: usize, row: usize) -> f64

Returns one scalar cell.

Source

pub fn weights_at(&self, row: usize) -> f64

Returns the explicit row weight, or one when weights are absent.

Source

pub fn event(&self, row: usize) -> BatchEvent<'_>

Returns a borrowed view of one row.

Source

pub fn iter(&self) -> impl Iterator<Item = BatchEvent<'_>>

Iterates over borrowed event views.

Source

pub fn select(&self, rows: &[usize]) -> Self

Copies selected rows into a new batch in the requested order.

Source

pub fn filter<F>(&self, keep: F) -> Self
where F: Fn(BatchEvent<'_>) -> bool,

Copies rows satisfying keep into a new batch.

Source

pub fn reweight<F>(&self, f: F) -> Self
where F: Fn(usize, f64) -> f64,

Returns a batch sharing value columns with newly computed weights.

Source

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.

Source

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

Source§

fn clone(&self) -> EventBatch

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventBatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.