Skip to main content

DataTableBuilder

Struct DataTableBuilder 

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

Builder for constructing a DataTable column-by-column.

Collects columns (as Arrow arrays) and a schema, then builds a RecordBatch.

Implementations§

Source§

impl DataTableBuilder

Source

pub fn new(schema: Schema) -> Self

Create a builder from an Arrow schema.

Source

pub fn with_fields(fields: Vec<Field>) -> Self

Create a builder with just field definitions (convenience).

Source

pub fn add_f64_column(&mut self, values: Vec<f64>) -> &mut Self

Add a Float64 column.

Source

pub fn add_i64_column(&mut self, values: Vec<i64>) -> &mut Self

Add an Int64 column.

Source

pub fn add_string_column(&mut self, values: Vec<&str>) -> &mut Self

Add a String column.

Source

pub fn add_bool_column(&mut self, values: Vec<bool>) -> &mut Self

Add a Boolean column.

Source

pub fn add_timestamp_column(&mut self, values: Vec<i64>) -> &mut Self

Add a TimestampMicrosecond column.

Source

pub fn add_column(&mut self, array: ArrayRef) -> &mut Self

Add a pre-built Arrow array column.

Source

pub fn finish(self) -> Result<DataTable, ArrowError>

Build the DataTable. Returns an error if schema/column mismatch.

Source

pub fn finish_with_type_name( self, type_name: String, ) -> Result<DataTable, ArrowError>

Build a DataTable with an associated type name.

Source

pub fn finish_with_schema_id( self, schema_id: u32, ) -> Result<DataTable, ArrowError>

Build a DataTable with schema ID for typed tables.

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.