Apache DataFusion SQL Query Engine
feat: add accessor to SessionContext fields for ContextProvider impl (#5318)
Ning Sun5d5b1a0bd823
diff --git a/datafusion/core/src/execution/context.rs b/datafusion/core/src/execution/context.rsindex c2ac3c2e9f..8944b4f905 100644--- a/datafusion/core/src/execution/context.rs+++ b/datafusion/core/src/execution/context.rs@@ -1915,6 +1915,16 @@ impl SessionState {pub fn catalog_list(&self) -> Arc<dyn CatalogList> {self.catalog_list.clone()}++ /// Return reference to scalar_functions+ pub fn scalar_functions(&self) -> &HashMap<String, Arc<ScalarUDF>> {+ &self.scalar_functions+ }++ /// Return reference to aggregate_functions+ pub fn aggregate_functions(&self) -> &HashMap<String, Arc<AggregateUDF>> {+ &self.aggregate_functions+ }}struct SessionContextProvider<'a> {@@ -1932,11 +1942,11 @@ impl<'a> ContextProvider for SessionContextProvider<'a> {}fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>> {- self.state.scalar_functions.get(name).cloned()+ self.state.scalar_functions().get(name).cloned()}fn get_aggregate_meta(&self, name: &str) -> Option<Arc<AggregateUDF>> {- self.state.aggregate_functions.get(name).cloned()+ self.state.aggregate_functions().get(name).cloned()}fn get_variable_type(&self, variable_names: &[String]) -> Option<DataType> {