alamb commented on code in PR #10661:
URL: https://github.com/apache/datafusion/pull/10661#discussion_r1614546056


##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -2860,6 +2863,57 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn test_register_default_functions() -> Result<()> {
+        let config = SessionConfig::new();
+        let catalog_list =
+            Arc::new(MemoryCatalogProviderList::new()) as Arc<dyn 
CatalogProviderList>;
+        let mut new_state = SessionState {
+            session_id: Uuid::new_v4().to_string(),
+            analyzer: Analyzer::new(),
+            optimizer: Optimizer::new(),
+            physical_optimizers: PhysicalOptimizer::new(),
+            query_planner: Arc::new(DefaultQueryPlanner {}),
+            catalog_list,
+            table_functions: HashMap::new(),
+            scalar_functions: HashMap::new(),
+            aggregate_functions: HashMap::new(),
+            window_functions: HashMap::new(),
+            serializer_registry: Arc::new(EmptySerializerRegistry),
+            table_option_namespace: TableOptions::default_from_session_config(
+                config.options(),
+            ),
+            config,
+            execution_props: ExecutionProps::new(),
+            runtime_env: Arc::new(RuntimeEnv::default()),
+            table_factories: HashMap::new(),
+            function_factory: None,
+        };
+
+        for function in all_default_functions() {

Review Comment:
   This is a nice test -- though it is basically a copy of SessionContext::new
   
   I wonder if we could make a test that is a bit simpler for example by 
creating a new 
    
https://docs.rs/datafusion/latest/datafusion/execution/registry/struct.MemoryFunctionRegistry.html
   
   Something like (untested)
   ```rust
   let registry = MemoryFunctionRegistry::new();
   for function in all_default_array_functions() {
     let existing_function = new_state.register_udf(function);
     assert!(existing_function.is_none(), "{} was already registered", 
function.name()
   }
   // and similarly for the aggregate and array functins
   ```
   
   🤔 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to