pub struct Table { /* private fields */ }Expand description
This is a convenience wrapper around Vec<RecordBatch> that tries to simplify conversion from
and to pyarrow.Table.
This could be used in circumstances where you either want to consume a pyarrow.Table directly
(although technically, since pyarrow.Table implements the ArrayStreamReader PyCapsule
interface, one could also consume a PyArrowType<ArrowArrayStreamReader> instead) or, more
importantly, where one wants to export a pyarrow.Table from a Vec<RecordBatch> from the Rust
side.
ⓘ
#[pyfunction]
fn return_table(...) -> PyResult<PyArrowType<Table>> {
let batches: Vec<RecordBatch>;
let schema: SchemaRef;
PyArrowType(Table::try_new(batches, schema).map_err(|err| err.into_py_err(py))?)
}Implementations§
Source§impl Table
impl Table
pub fn try_new( record_batches: Vec<RecordBatch>, schema: Arc<Schema>, ) -> Result<Table, ArrowError>
pub fn record_batches(&self) -> &[RecordBatch]
pub fn schema(&self) -> Arc<Schema> ⓘ
pub fn into_inner(self) -> (Vec<RecordBatch>, Arc<Schema>)
Trait Implementations§
Source§impl FromPyArrow for Table
Convert a pyarrow.Table (or any other ArrowArrayStream compliant object) into Table
impl FromPyArrow for Table
Convert a pyarrow.Table (or any other ArrowArrayStream compliant object) into Table
Source§impl IntoPyArrow for Table
Convert a Table into pyarrow.Table.
impl IntoPyArrow for Table
Convert a Table into pyarrow.Table.
Source§impl TryFrom<Box<dyn RecordBatchReader<Item = Result<RecordBatch, ArrowError>>>> for Table
impl TryFrom<Box<dyn RecordBatchReader<Item = Result<RecordBatch, ArrowError>>>> for Table
Source§type Error = ArrowError
type Error = ArrowError
The type returned in the event of a conversion error.
Source§fn try_from(
value: Box<dyn RecordBatchReader<Item = Result<RecordBatch, ArrowError>>>,
) -> Result<Table, ArrowError>
fn try_from( value: Box<dyn RecordBatchReader<Item = Result<RecordBatch, ArrowError>>>, ) -> Result<Table, ArrowError>
Performs the conversion.
Auto Trait Implementations§
impl !RefUnwindSafe for Table
impl !UnwindSafe for Table
impl Freeze for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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