Trait datafusion_sql::planner::ContextProvider
source · pub trait ContextProvider {
// Required methods
fn get_table_source(
&self,
name: TableReference
) -> Result<Arc<dyn TableSource>>;
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 udfs_names(&self) -> Vec<String>;
fn udafs_names(&self) -> Vec<String>;
fn udwfs_names(&self) -> Vec<String>;
// Provided methods
fn get_table_provider(
&self,
name: TableReference
) -> Result<Arc<dyn TableSource>> { ... }
fn get_table_function_source(
&self,
_name: &str,
_args: Vec<Expr>
) -> Result<Arc<dyn TableSource>> { ... }
fn create_cte_work_table(
&self,
_name: &str,
_schema: SchemaRef
) -> Result<Arc<dyn TableSource>> { ... }
}
Expand description
The ContextProvider trait allows the query planner to obtain meta-data about tables and functions referenced in SQL statements
Required Methods§
sourcefn get_table_source(&self, name: TableReference) -> Result<Arc<dyn TableSource>>
fn get_table_source(&self, name: TableReference) -> Result<Arc<dyn TableSource>>
Getter for a datasource
sourcefn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>
fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>>
Getter for a UDAF description
sourcefn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>
fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType>
Getter for system/user-defined variable type
sourcefn options(&self) -> &ConfigOptions
fn options(&self) -> &ConfigOptions
Get configuration options
fn udfs_names(&self) -> Vec<String>
fn udafs_names(&self) -> Vec<String>
fn udwfs_names(&self) -> Vec<String>
Provided Methods§
fn get_table_provider( &self, name: TableReference ) -> Result<Arc<dyn TableSource>>
👎Deprecated since 32.0.0: please use
get_table_source
insteadsourcefn get_table_function_source(
&self,
_name: &str,
_args: Vec<Expr>
) -> Result<Arc<dyn TableSource>>
fn get_table_function_source( &self, _name: &str, _args: Vec<Expr> ) -> Result<Arc<dyn TableSource>>
Getter for a table function
sourcefn create_cte_work_table(
&self,
_name: &str,
_schema: SchemaRef
) -> Result<Arc<dyn TableSource>>
fn create_cte_work_table( &self, _name: &str, _schema: SchemaRef ) -> Result<Arc<dyn TableSource>>
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.