Trait datafusion::sql::planner::ContextProvider

source ·
pub trait ContextProvider {
    // Required methods
    fn get_table_source(
        &self,
        name: TableReference,
    ) -> Result<Arc<dyn TableSource>, DataFusionError>;
    fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>>;
    fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>;
    fn get_window_meta(&self, name: &str) -> Option<Arc<WindowUDF>>;
    fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>;
    fn options(&self) -> &ConfigOptions;
    fn udf_names(&self) -> Vec<String>;
    fn udaf_names(&self) -> Vec<String>;
    fn udwf_names(&self) -> Vec<String>;

    // Provided methods
    fn get_file_type(
        &self,
        _ext: &str,
    ) -> Result<Arc<dyn FileType>, DataFusionError> { ... }
    fn get_table_function_source(
        &self,
        _name: &str,
        _args: Vec<Expr>,
    ) -> Result<Arc<dyn TableSource>, DataFusionError> { ... }
    fn create_cte_work_table(
        &self,
        _name: &str,
        _schema: Arc<Schema>,
    ) -> Result<Arc<dyn TableSource>, DataFusionError> { ... }
}
Expand description

Provides the SQL query planner meta-data about tables and functions referenced in SQL statements, without a direct dependency on other DataFusion structures

Required Methods§

source

fn get_table_source( &self, name: TableReference, ) -> Result<Arc<dyn TableSource>, DataFusionError>

Getter for a datasource

source

fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>>

Getter for a UDF description

source

fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>

Getter for a UDAF description

source

fn get_window_meta(&self, name: &str) -> Option<Arc<WindowUDF>>

Getter for a UDWF

source

fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>

Getter for system/user-defined variable type

source

fn options(&self) -> &ConfigOptions

Get configuration options

source

fn udf_names(&self) -> Vec<String>

Get all user defined scalar function names

source

fn udaf_names(&self) -> Vec<String>

Get all user defined aggregate function names

source

fn udwf_names(&self) -> Vec<String>

Get all user defined window function names

Provided Methods§

source

fn get_file_type( &self, _ext: &str, ) -> Result<Arc<dyn FileType>, DataFusionError>

source

fn get_table_function_source( &self, _name: &str, _args: Vec<Expr>, ) -> Result<Arc<dyn TableSource>, DataFusionError>

Getter for a table function

source

fn create_cte_work_table( &self, _name: &str, _schema: Arc<Schema>, ) -> Result<Arc<dyn TableSource>, DataFusionError>

This provides a worktable (an intermediate table that is used to store the results of a CTE during execution) We don’t directly implement this in the logical plan’s [’SqlToRel] because the sql code needs access to a table that contains execution-related types that can't be a direct dependency of the sql crate (namely, the CteWorktable). The [ContextProvider`] provides a way to “hide” this dependency.

Implementors§