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§
Sourcetype Builders: BuildersLike<Row = Self::Row>
type Builders: BuildersLike<Row = Self::Row>
Concrete builders used to accumulate rows into columns.
Required Methods§
Sourcefn schema_ref(&self) -> Arc<Schema>
fn schema_ref(&self) -> Arc<Schema>
Return a shared reference to the underlying Arrow Schema
.
Sourcefn new_builders(&self, capacity: usize) -> Self::Builders
fn new_builders(&self, capacity: usize) -> Self::Builders
Create new column builders with a given capacity hint.
Provided Methods§
Sourcefn build_batch<I>(
&self,
rows: I,
) -> Result<RecordBatch, <Self::Builders as BuildersLike>::Error>where
I: IntoIterator<Item = Self::Row>,
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 ExactSizeIterator
s 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.
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.
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.
impl<R> SchemaLike for Typed<R>where
R: SchemaMeta + BuildRows,
Typed schema: compile-time path.