Skip to main content

CustomDataSerialize

Trait CustomDataSerialize 

Source
pub trait CustomDataSerialize: CustomDataTrait {
    // Required methods
    fn schema(&self) -> Result<Schema>;
    fn encode_record_batch(
        &self,
        items: &[Arc<dyn CustomDataTrait>],
    ) -> Result<RecordBatch>;
}
Expand description

Trait for custom data types that support Arrow schema and record batch encoding. Used as a type bound by the #[custom_data] macro; catalog encoding goes through the registry, not this trait directly.

Implemented by the #[custom_data] macro for Rust custom data types. Python custom types use the registry encoder registered by register_custom_data_class instead.

Required Methods§

Source

fn schema(&self) -> Result<Schema>

Returns the Arrow schema for this custom data type.

§Errors

Returns an error if schema construction fails.

Source

fn encode_record_batch( &self, items: &[Arc<dyn CustomDataTrait>], ) -> Result<RecordBatch>

Encodes a batch of custom data items to an Arrow RecordBatch.

§Errors

Returns an error if encoding fails (e.g. type mismatch or Arrow error).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§