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: SchemaRef, ) -> Result<Self, ArrowError>
pub fn record_batches(&self) -> &[RecordBatch]
pub fn schema(&self) -> SchemaRef
pub fn into_inner(self) -> (Vec<RecordBatch>, SchemaRef)
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>) -> Result<Self, ArrowError>
fn try_from(value: Box<dyn RecordBatchReader>) -> Result<Self, ArrowError>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for Table
impl !RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl !UnwindSafe for Table
Blanket Implementations§
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