-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support computing ScalarValue return types from argument values (e.g. constants) rather than just types #8624
Comments
I think we can probably work on this now that #8568 is merged |
Since my first PR is close to be merged. I'd like to work on this as a next. 😀 |
Thanks @yyy1000 -- FYI aware this is likely to be an exercise in careful API design Perhaps you could look into extending For example: trait ScalarUDFImpl {
...
/// What [`DataType`] will be returned by this function, given the types of
/// the expr arguments
fn return_type_from_exprs(&self, arg_exprs: &[Expr], schema: &SchemaRef) -> Result<DataType> {
// provide default implementation that calls `self.return_type()`
// so that people don't have to implement `return_type_from_exprs` if they dont want to
}
...
} An exellent test of the new API would be to see if you can implement |
I created a PR in #8985 that wants to fix this. ❤️ |
Def one UDF:
Using:
case1:
case2:
At present, the above udf cannot be realized through the
ReturnTypeFunction
. This is because theReturnTypeFunction
provides only the data types of the input parameters.As we discussed on #7657 (comment)
arrow_cast
does this but it is handled specially. This ticket tracks adding UDF support for itOriginally posted by @JasonLi-cn in #7657
The text was updated successfully, but these errors were encountered: