SchemaLike

Trait SchemaLike 

Source
pub trait SchemaLike {
    type Row;
    type Builders: BuildersLike<Row = Self::Row>;

    // Required methods
    fn schema_ref(&self) -> Arc<Schema>;
    fn new_builders(&self, capacity: usize) -> Self::Builders;

    // Provided method
    fn build_batch<I>(
        &self,
        rows: I,
    ) -> Result<RecordBatch, <Self::Builders as BuildersLike>::Error>
       where I: IntoIterator<Item = Self::Row> { ... }
}
Expand description

Unified schema abstraction: exposes Arrow schema and row/builder types.

Required Associated Types§

Source

type Row

The row type produced/consumed for this schema.

Source

type Builders: BuildersLike<Row = Self::Row>

Concrete builders used to accumulate rows into columns.

Required Methods§

Source

fn schema_ref(&self) -> Arc<Schema>

Return a shared reference to the underlying Arrow Schema.

Source

fn new_builders(&self, capacity: usize) -> Self::Builders

Create new column builders with a given capacity hint.

Provided Methods§

Source

fn build_batch<I>( &self, rows: I, ) -> Result<RecordBatch, <Self::Builders as BuildersLike>::Error>
where I: IntoIterator<Item = Self::Row>,

Build a RecordBatch from an iterator of rows.

Capacity is inferred from the iterator’s size hint (upper bound if present, otherwise the lower bound). For ExactSizeIterators like Vec and slices this yields exact preallocation.

§Errors

Returns an error if row appends or batch finishing fails on the dynamic path.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SchemaLike for Arc<Schema>

Convenience: treat an Arc<Schema> (aka SchemaRef) as a dynamic schema.

Source§

impl SchemaLike for DynSchema

Dynamic schema: runtime path.

Implementors§

Source§

impl<R> SchemaLike for Typed<R>
where R: SchemaMeta + BuildRows,

Typed schema: compile-time path.