Skip to main content

Executor

Trait Executor 

Source
pub trait Executor:
    Debug
    + Send
    + Sync {
    // Required methods
    fn translate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        hamelin: &'life1 str,
        time_range: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<CompiledQuery, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn ir<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        hamelin: &'life1 str,
        time_range: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<CompiledQuery, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn explain<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        hamelin: &'life1 str,
        time_range: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<String, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn execute_query<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        hamelin: &'life1 str,
        time_range: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<ResultSet, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn execute_dml<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        hamelin: &'life1 str,
        time_range: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<usize, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn create_dataset<'life0, 'async_trait>(
        &'life0 self,
        dataset: Identifier,
        columns: Vec<Column>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn resolve_datasets<'life0, 'life1, 'async_trait>(
        &'life0 self,
        datasets: &'life1 [Identifier],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Column>>, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reflect_catalog<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Catalog, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn stats(&self) -> Option<ExecutorStats> { ... }
}

Required Methods§

Source

fn translate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hamelin: &'life1 str, time_range: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<CompiledQuery, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Compile a Hamelin query string without executing it. Returns a human-readable representation and the output schema.

Source

fn ir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hamelin: &'life1 str, time_range: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<CompiledQuery, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Lower a Hamelin query to IR and return its display representation.

Each executor applies its own normalization options (e.g. DataFusion enables with_lower_filter() and with_lower_transform() while Trino does not), so the IR output reflects what the executor will actually process.

Source

fn explain<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hamelin: &'life1 str, time_range: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Produce an execution plan for a Hamelin query without executing it.

For DataFusion, this returns the physical plan. For Trino, this returns the output of EXPLAIN (TYPE DISTRIBUTED) <sql>.

Source

fn execute_query<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hamelin: &'life1 str, time_range: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<ResultSet, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute a Hamelin query string, return rows. time_range is an optional Hamelin range expression (e.g., “[-1h..]”)

Source

fn execute_dml<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, hamelin: &'life1 str, time_range: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<usize, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute a Hamelin DML string, return rows affected.

Source

fn create_dataset<'life0, 'async_trait>( &'life0 self, dataset: Identifier, columns: Vec<Column>, ) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a dataset in the underlying database.

Source

fn resolve_datasets<'life0, 'life1, 'async_trait>( &'life0 self, datasets: &'life1 [Identifier], ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Column>>, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve one or more datasets’ columns.

Returns columns in the same order as the input slice — callers can zip the result with their identifiers.

Source

fn reflect_catalog<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Catalog, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reflect the schema of the default catalog.

This is a proactive reflection operation that queries the underlying backend for its current schema. For Trino, this queries information_schema.columns scoped to the default catalog set on the connection. For DataFusion, this resolves all locally-configured datasets and enumerates the SessionContext’s registered tables.

Provided Methods§

Source

fn stats(&self) -> Option<ExecutorStats>

Snapshot cumulative executor stats, if the backend tracks them.

DataFusion populates these by walking the physical plan’s MetricsSet after each query. Trino and other backends return None.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§