gaojun2048 edited a comment on pull request #1881:
URL: 
https://github.com/apache/arrow-datafusion/pull/1881#issuecomment-1065889841


   In fact, after the external UDF/UDAF is registered with datafusion's 
`ExecutionContext` via the `register_udf` function, As long as we know the name 
of UDF/UDAF, we can obtain the implementation of UDF/UDAF from ExecutionContext 
in the following ways to complete the deserialization of UDF/UDAF. 
   
   ```
   impl FunctionRegistry for ExecutionContext {
       fn udfs(&self) -> HashSet<String> {
           self.state.lock().udfs()
       }
   
       fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>> {
           self.state.lock().udf(name)
       }
   
       fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>> {
           self.state.lock().udaf(name)
       }
   }
   ```
   
   So we can put name in proto when we serialize UDF/UDAF, and then we can 
deserialize UDF/UDAF using this name and ExecutionContext.
   But that need add a function like this:
   
   ```
   fn from_proto_to_logicalplan(logical_plan: &protobuf::LogicalExprNode, ctx: 
&ExecutionContext) -> Result<LogicalPlan, Error>
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to