This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 5d5b1a0bd feat: add accessor to SessionContext fields for
ContextProvider impl (#5318)
5d5b1a0bd is described below
commit 5d5b1a0bd8234465d179adc0b947bb439acc91f7
Author: Ning Sun <[email protected]>
AuthorDate: Sun Feb 19 00:07:21 2023 +0800
feat: add accessor to SessionContext fields for ContextProvider impl (#5318)
---
datafusion/core/src/execution/context.rs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/datafusion/core/src/execution/context.rs
b/datafusion/core/src/execution/context.rs
index c2ac3c2e9..8944b4f90 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>
{