Skip to main content

SQLExecutor

Trait SQLExecutor 

Source
pub trait SQLExecutor: Sync + Send {
    // Required methods
    fn name(&self) -> &str;
    fn compute_context(&self) -> Option<String>;
    fn dialect(&self) -> Arc<dyn Dialect>;
    fn execute(
        &self,
        query: &str,
        schema: SchemaRef,
        filters: &[Arc<dyn PhysicalExpr>],
    ) -> Result<SendableRecordBatchStream>;
    fn table_names<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_table_schema<'life0, 'life1, 'async_trait>(
        &'life0 self,
        table_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<SchemaRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn logical_optimizer(&self) -> Option<LogicalOptimizer> { ... }
    fn ast_analyzer(&self) -> Option<AstAnalyzer> { ... }
    fn statistics<'life0, 'life1, 'async_trait>(
        &'life0 self,
        plan: &'life1 LogicalPlan,
    ) -> Pin<Box<dyn Future<Output = Result<Statistics>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn metrics(&self) -> Option<MetricsSet> { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Executor name

Source

fn compute_context(&self) -> Option<String>

Executor compute context allows differentiating the remote compute context such as authorization or active database.

Note: returning None here may cause incorrect federation with other providers of the same name that also have a compute_context of None. Instead try to return a unique string that will never match any other provider’s context.

Source

fn dialect(&self) -> Arc<dyn Dialect>

The specific SQL dialect (currently supports ‘sqlite’, ‘postgres’, ‘flight’)

Source

fn execute( &self, query: &str, schema: SchemaRef, filters: &[Arc<dyn PhysicalExpr>], ) -> Result<SendableRecordBatchStream>

Execute a SQL query.

filters contain physical expressions generated at runtime, like DynamicFilterPhysicalExpr. Since the concrete expression values only become available when the SendableRecordBatchStream is executed, they must be manually added to the SQL query, if necessary. However, they can be safely ignored.

Source

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

Returns the tables provided by the remote

Source

fn get_table_schema<'life0, 'life1, 'async_trait>( &'life0 self, table_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<SchemaRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the schema of table_name within this SQLExecutor

Provided Methods§

Source

fn logical_optimizer(&self) -> Option<LogicalOptimizer>

Returns the analyzer rule specific for this engine to modify the logical plan before execution

Source

fn ast_analyzer(&self) -> Option<AstAnalyzer>

Returns an AST analyzer specific for this engine to modify the AST before execution

Source

fn statistics<'life0, 'life1, 'async_trait>( &'life0 self, plan: &'life1 LogicalPlan, ) -> Pin<Box<dyn Future<Output = Result<Statistics>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns statistics for this SQLExecutor node. If statistics are not available, it should return Statistics::new_unknown (the default), not an error. See the ExecutionPlan trait.

Source

fn metrics(&self) -> Option<MetricsSet>

Returns the execution metrics, if available.

Trait Implementations§

Source§

impl Debug for dyn SQLExecutor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for dyn SQLExecutor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§