-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add ScalarUDF support in FFI crate #14579
Conversation
… forth between result and rresult
…t this shouldn't be necessary
…lean, but this shouldn't be necessary" This reverts commit 10248c2.
b13fcfe
to
72279df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @timsaucer - this looks good to me. I do think it would be valuable to seriously consider simplifying the Signature portion of the FFI to keep it smaller and more likely to be be stable
Also as I understand, having an FFI API for functions would make it easier for function libraries to be used without having to exactly match the DataFuson version which seems like a great idea to me.
datafusion/ffi/src/signature.rs
Outdated
#[repr(C)] | ||
#[derive(StableAbi)] | ||
#[allow(non_camel_case_types)] | ||
pub struct FFI_Signature { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should keep this API simpler as I think the actual signature API is about to change in the near future. For example, the work from @jayzhan211 and @shehabgamin in the following PR
One thought I had was to to only support the equivalent of TypeSignature::UserDefined
While this would make it somewhat less conveniente to implement user defined functions I think it would result in much smaller FFI API and also be much less likely to change overtime
Maybe once the TypeSignature / Coecion code has settled down we could add more to the FFI interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this now match what you were looking for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks @timsaucer
|
||
pub volatility: FFI_Volatility, | ||
|
||
pub return_type: unsafe extern "C" fn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually it would be great to document these a bit more -- for example here we can mention that we only expose the return type method to simplify the signature
woohoo! |
Which issue does this PR close?
Addresses part of #14562 - specifically scalar udfs
Rationale for this change
This is a pure addition were we expose
ScalarUDF
across the FFI boundary. This enables new functionality about creating reusable libraries, such as in python.What changes are included in this PR?
Addition of scalar udf FFI wrappers
Are these changes tested?
Are there any user-facing changes?
This is a pure addition.