pub trait ArrowImportVTable:
'static
+ Send
+ Sync
+ Debug {
// Required methods
fn arrow_ext_id(&self) -> Id;
fn from_arrow_field(
&self,
field: &Field,
session: &ArrowSession,
) -> VortexResult<Option<DType>>;
fn from_arrow_array(
&self,
array: ArrowArrayRef,
field: &Field,
dtype: &DType,
session: &ArrowSession,
) -> VortexResult<ArrowImport>;
}Expand description
Plugin layer for importing an Arrow extension-typed array into a Vortex array.
Plugins are dispatched by arrow_ext_id. The session peels Arrow dictionaries before it
dispatches, so a plugin never sees a DataType::Dictionary field or array. It sees the value
field, with the dictionary field’s metadata, and the values array. The session then wraps the
plugin’s result in a DictArray with the dictionary’s codes.
Arrow stores dictionary values as a bare DataType, so their extension metadata lives on
the outer Field. Peeling the dictionary lets the importer see the value type described by
that metadata. DataType::RunEndEncoded has a separate values field that can carry its own
extension metadata, so its values use the normal nested-field import path.
This is purely an implementation trait, its methods should not be called directly. Instead,
use the methods on ArrowSession.
Required Methods§
Sourcefn arrow_ext_id(&self) -> Id
fn arrow_ext_id(&self) -> Id
The Arrow extension name this plugin handles.
Sourcefn from_arrow_field(
&self,
field: &Field,
session: &ArrowSession,
) -> VortexResult<Option<DType>>
fn from_arrow_field( &self, field: &Field, session: &ArrowSession, ) -> VortexResult<Option<DType>>
Build the Vortex DType that corresponds to field (which carries this plugin’s
Arrow extension metadata).
session is provided so plugins can resolve nested or storage fields through the
plugin-aware conversion (e.g. ArrowSession::from_arrow_datatype) instead of the
naive Arrow → Vortex mapping.
Sourcefn from_arrow_array(
&self,
array: ArrowArrayRef,
field: &Field,
dtype: &DType,
session: &ArrowSession,
) -> VortexResult<ArrowImport>
fn from_arrow_array( &self, array: ArrowArrayRef, field: &Field, dtype: &DType, session: &ArrowSession, ) -> VortexResult<ArrowImport>
Convert an Arrow array into a Vortex array of dtype.
Returns ownership of array via ArrowImport::Unsupported when the plugin cannot
handle the input.
session is provided so plugins can convert storage or nested arrays through the
session (e.g. ArrowSession::from_arrow_array, passing a nullability rather than a
Field so the plugin is not dispatched again).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".