Skip to main content

ArrowTable

Struct ArrowTable 

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

Arrow record batches shown as one table: rows run through the batches in order.

Formatting is chosen per column from its data type when a batch is added, so writing a cell is a lookup and a format into a stack buffer, without allocating. Batches can be appended while the table is shown (a stream); their arrays are shared, not copied.

Formatted types: booleans, integers, floats, Decimal128, strings (Utf8, LargeUtf8, Utf8View), dictionaries of those, dates, times, timestamps (with a time zone: in UTC, marked Z) and durations. Other types (lists, structs, maps, binary, intervals) show ?.

A batch is accepted when its columns have the table’s data types in order; field names, nullability and metadata may differ. A timestamp’s time zone is part of its data type.

Implementations§

Source§

impl ArrowTable

Source

pub fn new(schema: SchemaRef) -> Self

An empty table for batches with schema; columns are sized by their titles until the first rows arrive.

Source

pub fn from_batches( batches: impl IntoIterator<Item = RecordBatch>, ) -> Result<Self, TableError>

A table of batches, with the first batch’s schema.

§Errors

TableError::NoBatches for none; a column error if a batch’s schema differs.

Source

pub fn push(&mut self, batch: RecordBatch) -> Result<(), TableError>

Appends batch’s rows. The first rows to arrive size the columns (their titles and up to the first 1,000 values, at most 40 characters), except columns sized with set_column_chars.

§Errors

A column error if batch has other columns or data types; the table is unchanged.

Source

pub fn schema(&self) -> &SchemaRef

The table’s schema.

Source

pub fn rows(&self) -> usize

Rows in all batches.

Source

pub fn columns(&self) -> Vec<Column>

Grid columns: titled by field name, sized by content, numbers and times aligned right.

Source

pub fn set_decimals( &mut self, column: usize, decimals: Option<usize>, ) -> Result<(), TableError>

Prints floating-point values of column with decimals fixed decimal places (None: the shortest exact form). A column sized by the first rows is sized again from them, as now printed.

§Errors

TableError::NoSuchColumn if there is no such column.

Source

pub fn set_column_chars( &mut self, column: usize, chars: usize, ) -> Result<(), TableError>

Sets column to chars characters wide (1 to CELL_BYTES, the most a cell can hold): columns reports it, longer text is cut to fit ending in …, and the first rows to arrive no longer size it.

§Errors

TableError::NoSuchColumn if there is no such column.

Source

pub fn write_cell( &self, row: usize, column: usize, text: &mut CellText, ) -> CellState

Appends the value at row of column to text, or a placeholder (see CellState), never a partial value. Never allocates.

Source

pub fn view<'a>(&'a self, first_row: usize, palette: &Palette) -> ArrowGrid<'a>

A GridSource showing the table from first_row (scrolled), in palette’s text color, with nulls and unsupported values dimmed.

Trait Implementations§

Source§

impl Clone for ArrowTable

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 ArrowTable

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> 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> 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.