Skip to main content

ArrowRleBatch

Struct ArrowRleBatch 

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

Many Arrow-backed sequences, each identified by a row of a key table.

The keys are a RecordBatch with any number of columns of any types (for example a chromosome and a strand column), one row per sequence. Sequences are stored back to back: sequence i is runs offsets[i]..offsets[i + 1] of ends and values, with ends restarting at 0. Batch operations run in parallel across sequences.

Implementations§

Source§

impl ArrowRleBatch

Source

pub fn try_new( keys: RecordBatch, offsets: Vec<usize>, ends: Vec<i64>, values: ArrayRef, ) -> Result<Self>

Builds a batch from its flat parts, validating them. Keys must be unique.

Source

pub fn from_rles( keys: RecordBatch, rles: Vec<ArrowRle>, data_type: &DataType, ) -> Result<Self>

Builds a batch from one key row and one sequence per entry. All sequences must have the same value type, data_type.

Source

pub fn len(&self) -> usize

The number of sequences.

Source

pub fn is_empty(&self) -> bool

Source

pub fn keys(&self) -> &RecordBatch

The key table, one row per sequence.

Source

pub fn offsets(&self) -> &[usize]

Source

pub fn ends(&self) -> &[i64]

The run ends of all sequences, back to back.

Source

pub fn values(&self) -> &ArrayRef

The run values of all sequences, back to back.

Source

pub fn get_index(&self, position: usize) -> Option<ArrowRle>

The sequence at position. The values are a zero-copy slice.

Source

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

The sequences in key order.

Source

pub fn positions(&self, keys: &RecordBatch) -> Result<Vec<Option<usize>>>

The position of each row of keys in this batch, or None if absent. keys must have the same column types as this batch’s keys.

Source

pub fn zip_with<F>( &self, other: &ArrowRleBatch, how: How, fill_a: Option<&dyn Array>, fill_b: Option<&dyn Array>, f: F, ) -> Result<ArrowRleBatch>
where F: Fn(&dyn Array, &dyn Array) -> Result<ArrayRef, ArrowError> + Sync,

Combines two batches key by key, in parallel, merging each result.

Both key tables must have the same column names and types. how picks the keys, which appear in the left batch’s order followed by keys only in the right batch. A key missing on one side is an empty sequence there, padded with that side’s fill value. See ArrowRle::zip_with for f.

Source

pub fn to_record_batch(&self) -> Result<RecordBatch>

The batch as one long table: the key columns, then start, end and value, with one row per run. This is the natural shape for polars or pandas.

Source

pub fn zip_with_default( &self, other: &ArrowRleBatch, f: Kernel, ) -> Result<ArrowRleBatch>

Combines with other by an outer join, using default_fill on each side, and merges.

Source§

impl ArrowRleBatch

Source

pub fn add(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise addition (integer overflow is an error). Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn sub(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise subtraction (integer overflow is an error). Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn mul(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise multiplication (integer overflow is an error). Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn div(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise division (integer division by zero is an error). Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn elem_eq(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise ==. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn elem_ne(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise !=. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn elem_lt(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise <. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn elem_le(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise <=. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn elem_gt(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise >. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn elem_ge(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise >=. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn and(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise logical and, with SQL semantics for nulls. Keys are outer-joined and shorter sides padded with default_fill.

Source

pub fn or(&self, other: &ArrowRleBatch) -> Result<ArrowRleBatch>

Element-wise logical or, with SQL semantics for nulls. Keys are outer-joined and shorter sides padded with default_fill.

Source§

impl ArrowRleBatch

Source

pub fn slice_agg( &self, keys: &RecordBatch, starts: &[i64], ends: &[i64], agg: SliceAgg, ) -> Result<ArrayRef>

Like ArrowRle::slice_agg, where slice k is in the sequence of row k of keys. A key not in the batch gives an empty slice. keys must have the same column names and types as the batch’s keys.

Source§

impl ArrowRleBatch

Source

pub fn collapse(&self, keep: &[&str], kernel: Kernel) -> Result<ArrowRleBatch>

Combines the sequences whose keys agree on the keep columns, folding each group with kernel in key order, in parallel across groups.

For example, keeping only Chromosome with kernels::add adds the strands of each chromosome together. Sequences of different lengths are padded with default_fill.

Source§

impl ArrowRleBatch

Source

pub fn shift(&self, distance: i64, fill: &dyn Array) -> Result<ArrowRleBatch>

Shifts every sequence, in parallel; see ArrowRle::shift.

Source

pub fn reversed(&self) -> Result<ArrowRleBatch>

Reverses every sequence, in parallel.

Source

pub fn map_rles<F>(&self, f: F) -> Result<ArrowRleBatch>
where F: Fn(&ArrowRle) -> Result<ArrowRle> + Sync,

Transforms every sequence in parallel, keeping the keys. All results must have the same value type.

Source

pub fn concat(batches: &[ArrowRleBatch]) -> Result<ArrowRleBatch>

Joins batches end to end key by key, in parallel: each key’s sequences are concatenated in batch order, and a batch without the key adds nothing. Keys appear in order of first appearance. All batches must have the same key columns and value type.

Trait Implementations§

Source§

impl Clone for ArrowRleBatch

Source§

fn clone(&self) -> Self

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 ArrowRleBatch

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ArrowRleBatch

Source§

fn eq(&self, other: &Self) -> bool

Same keys in the same order, and equal sequences for each.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

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> 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.