alamb commented on issue #6518:
URL: https://github.com/apache/datafusion/issues/6518#issuecomment-2585270509

   I have been working with @goldmedal  on a POC of this, and I am quite 
pleased with how it has come out. See:
   - https://github.com/goldmedal/datafusion-llm-function/pull/1
   
   Basically, the user just has to implement the following trait :bowtie: 
   
   
   ```rust
    /// A scalar UDF that can invoke using async methods
   ///
   /// Note this is less efficient than the ScalarUDFImpl, but it can be used
   /// to register remote functions in the context.
   ///
   /// The name is chosen to  mirror ScalarUDFImpl
   #[async_trait]
   pub trait AsyncScalarUDFImpl: Debug + Send + Sync {
       /// the function cast as any
       fn as_any(&self) -> &dyn Any;
   
       /// The name of the function
       fn name(&self) -> &str;
   
       /// The signature of the function
       fn signature(&self) -> &Signature;
   
       /// The return type of the function
       fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType>;
   
       /// Invoke the function asynchronously with the async arguments
       async fn invoke_async(&self, args: &RecordBatch) -> Result<ArrayRef>;
   }
   ```


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