Skip to main content

DataTable

Struct DataTable 

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

A columnar data table backed by Arrow RecordBatch.

DataTable wraps an Arrow RecordBatch and provides typed column access, zero-copy slicing, and interop with the Shape type system.

Implementations§

Source§

impl DataTable

Source

pub fn new(batch: RecordBatch) -> Self

Create a new DataTable from an Arrow RecordBatch.

Source

pub fn with_type_name(batch: RecordBatch, type_name: String) -> Self

Create a new DataTable with an associated type name.

Source

pub fn with_schema_id(self, schema_id: u32) -> Self

Set the schema ID for typed table access.

Source

pub fn with_index_col(self, name: String) -> Self

Set the index column name (from index_by()).

Source

pub fn set_origin(&mut self, source: ValueWord, params: ValueWord)

Set the origin (source, params) from the load() call that created this table.

Source

pub fn origin(&self) -> ValueWord

Get the origin as a structured TypedObject { source, params }. Returns ValueWord::none() if no origin is set.

Source

pub fn schema_id(&self) -> Option<u32>

Get the schema ID if this is a typed table.

Source

pub fn index_col(&self) -> Option<&str>

Get the index column name if set.

Source

pub fn column_ptr(&self, index: usize) -> Option<&ColumnPtrs>

Get column pointers for a column by index.

Source

pub fn column_ptrs(&self) -> &[ColumnPtrs]

Get all column pointers.

Source

pub fn row_count(&self) -> usize

Number of rows in the table.

Source

pub fn column_count(&self) -> usize

Number of columns in the table.

Source

pub fn column_names(&self) -> Vec<String>

Column names in order.

Source

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

The Arrow schema.

Source

pub fn type_name(&self) -> Option<&str>

The optional Shape type name.

Source

pub fn column_by_name(&self, name: &str) -> Option<&ArrayRef>

Get a column by name as a generic ArrayRef.

Source

pub fn get_f64_column(&self, name: &str) -> Option<&Float64Array>

Get a Float64 column by name.

Source

pub fn get_i64_column(&self, name: &str) -> Option<&Int64Array>

Get an Int64 column by name.

Source

pub fn get_string_column(&self, name: &str) -> Option<&StringArray>

Get a String (Utf8) column by name.

Source

pub fn get_bool_column(&self, name: &str) -> Option<&BooleanArray>

Get a Boolean column by name.

Source

pub fn get_timestamp_column( &self, name: &str, ) -> Option<&TimestampMicrosecondArray>

Get a TimestampMicrosecond column by name.

Source

pub fn slice(&self, offset: usize, length: usize) -> Self

Zero-copy slice of the DataTable.

Source

pub fn inner(&self) -> &RecordBatch

Borrow the inner RecordBatch.

Source

pub fn into_inner(self) -> RecordBatch

Consume and return the inner RecordBatch.

Source

pub fn is_empty(&self) -> bool

Check if the table is empty.

Trait Implementations§

Source§

impl Clone for DataTable

Source§

fn clone(&self) -> DataTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DataTable

Source§

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

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

impl Display for DataTable

Source§

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

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

impl PartialEq for DataTable

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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> 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.