alamb commented on a change in pull request #8030:
URL: https://github.com/apache/arrow/pull/8030#discussion_r475225101



##########
File path: rust/datafusion/src/execution/context.rs
##########
@@ -489,15 +489,13 @@ impl SchemaProvider for ExecutionContextState {
         self.datasources.get(name).map(|ds| ds.schema().clone())
     }
 
-    fn get_function_meta(&self, name: &str) -> Option<Arc<FunctionMeta>> {
-        self.scalar_functions.get(name).map(|f| {
-            Arc::new(FunctionMeta::new(
-                name.to_owned(),
-                f.args.clone(),
-                f.return_type.clone(),
-                FunctionType::Scalar,
-            ))
-        })
+    fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarFunction>> {

Review comment:
       Fascinatingly, I have added basically the same signature in 
https://github.com/apache/arrow/pull/8031. So I feel like we are heading in the 
same direction

##########
File path: rust/datafusion/src/execution/context.rs
##########
@@ -489,15 +489,13 @@ impl SchemaProvider for ExecutionContextState {
         self.datasources.get(name).map(|ds| ds.schema().clone())
     }
 
-    fn get_function_meta(&self, name: &str) -> Option<Arc<FunctionMeta>> {
-        self.scalar_functions.get(name).map(|f| {
-            Arc::new(FunctionMeta::new(
-                name.to_owned(),
-                f.args.clone(),
-                f.return_type.clone(),
-                FunctionType::Scalar,
-            ))
-        })
+    fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarFunction>> {
+        let fun = self.scalar_functions.get(name);

Review comment:
       I think you can do this in a single line:
   ```
           self.scalar_functions.get(name).and_then(|func| Some(func.clone()))
   ```




----------------------------------------------------------------
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.

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


Reply via email to