Skip to main content

SchemaInferable

Trait SchemaInferable 

Source
pub trait SchemaInferable: Send + Sync {
    // Required method
    fn sample_records<'life0, 'async_trait>(
        &'life0 self,
        max_records: usize,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<RawRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn infer_from_samples<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        samples: &'life1 [RawRecord],
        config: &'life2 InferenceConfig,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<InferredSchema>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

A connector that supports sample-based schema inference.

The connector provides raw sample records, and the inference engine determines the Arrow schema from the data.

Required Methods§

Source

fn sample_records<'life0, 'async_trait>( &'life0 self, max_records: usize, ) -> Pin<Box<dyn Future<Output = SchemaResult<Vec<RawRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads sample records from the source for inference.

The max_records parameter is a hint; implementations may return fewer.

§Errors

Returns a schema error if samples cannot be read.

Provided Methods§

Source

fn infer_from_samples<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, samples: &'life1 [RawRecord], config: &'life2 InferenceConfig, ) -> Pin<Box<dyn Future<Output = SchemaResult<InferredSchema>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Infers a schema from sample records.

Default implementation delegates to the global FormatInferenceRegistry.

§Errors

Returns a schema error if inference fails.

Implementors§