Skip to main content

TransformMiddleware

Trait TransformMiddleware 

Source
pub trait TransformMiddleware: Send + Sync {
    // Required method
    fn transform<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        sources: &'life1 IndexMap<String, DataTable>,
        spec: &'life2 TransformSpec,
        context: &'life3 TransformContext,
    ) -> Pin<Box<dyn Future<Output = Result<TransformResult, ChartError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn transform_batches<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        sources: &'life1 IndexMap<String, (SchemaRef, Vec<RecordBatch>)>,
        spec: &'life2 TransformSpec,
        context: &'life3 TransformContext,
    ) -> Pin<Box<dyn Future<Output = Result<TransformResult, ChartError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Transform middleware — processes data between fetch and render.

Receives a map of named source tables (insertion-ordered, matching the YAML data: map order) and produces a single result table that the renderer consumes. Implementations are expected to:

  • Register every entry in sources so user-authored SQL can reference any source by its declared name.
  • For single-entry maps with a non-"source" key, additionally register the sole table under the alias "source" so legacy SQL referencing FROM source keeps working. Multi-entry maps are NOT aliased — the caller’s SQL must use the explicit source names.

Required Methods§

Source

fn transform<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, sources: &'life1 IndexMap<String, DataTable>, spec: &'life2 TransformSpec, context: &'life3 TransformContext, ) -> Pin<Box<dyn Future<Output = Result<TransformResult, ChartError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Transform input data according to the spec.

Provided Methods§

Source

fn transform_batches<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, sources: &'life1 IndexMap<String, (SchemaRef, Vec<RecordBatch>)>, spec: &'life2 TransformSpec, context: &'life3 TransformContext, ) -> Pin<Box<dyn Future<Output = Result<TransformResult, ChartError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Batch-oriented transform. Receives multiple RecordBatches per source, allowing implementations to register them into MemTable without concatenation.

Default concatenates batches into DataTables and delegates to transform(). Override in DataFusionTransform to avoid the concat.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§