lance_datagen::generator

Struct BatchGeneratorBuilder

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

A builder to create a record batch reader with generated data

This type is meant to be used in a fluent builder style to define the schema and generators for a record batch reader.

Implementations§

Source§

impl BatchGeneratorBuilder

Source

pub fn new() -> Self

Create a new BatchGeneratorBuilder with a default random seed

Source

pub fn new_with_seed(seed: Seed) -> Self

Create a new BatchGeneratorBuilder with the given seed

Source

pub fn col(self, name: impl Into<String>, gen: Box<dyn ArrayGenerator>) -> Self

Adds a new column to the generator

See crate::generator::array for methods to create generators

Source

pub fn anon_col(self, gen: Box<dyn ArrayGenerator>) -> Self

Adds a new column to the generator with a generated unique name

See crate::generator::array for methods to create generators

Source

pub fn into_batch_rows( self, batch_size: RowCount, ) -> Result<RecordBatch, ArrowError>

Source

pub fn into_batch_bytes( self, batch_size: ByteCount, rounding: RoundingBehavior, ) -> Result<RecordBatch, ArrowError>

Source

pub fn into_reader_rows( self, batch_size: RowCount, num_batches: BatchCount, ) -> impl RecordBatchReader

Create a RecordBatchReader that generates batches of the given size (in rows)

Source

pub fn into_reader_stream( self, batch_size: RowCount, num_batches: BatchCount, ) -> BoxStream<'static, Result<RecordBatch, ArrowError>>

Source

pub fn into_reader_bytes( self, batch_size_bytes: ByteCount, num_batches: BatchCount, rounding: RoundingBehavior, ) -> Result<impl RecordBatchReader, ArrowError>

Create a RecordBatchReader that generates batches of the given size (in bytes)

Source

pub fn with_seed(self, seed: Seed) -> Self

Set the seed for the generator

Source

pub fn with_random_nulls(&mut self, default_null_probability: f64)

Adds nulls (with the given probability) to all columns

Trait Implementations§

Source§

impl Default for BatchGeneratorBuilder

Source§

fn default() -> BatchGeneratorBuilder

Returns the “default value” for a type. 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<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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V