You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge?
Instead of return_type + nullable. I think field is a better choice. Given windowudf is pretty new so not widely used yet (?). It would be nice to have field(&self, args: FieldArgs) -> Result<Field>
FieldArgs{arg_type:&[DataType]
schema:Schema// for nullable}
This is a proposal to add a field trait method for implementing user-defined window functions. And also remove (or deprecate) the trait methods return_type and nullable from WindowUDFImpl.
Both the return data type and nullability of the result from evaluating the user-defined window function will be specified by the field implementation.
Describe the solution you'd like
The current implementation for a user-defined window function (without field trait method) looks like this:
The implementation for a user-defined window function after this change:
implWindowUDFImplforRowNumber{fnfield(&self,field_args:WindowUDFFieldArgs) -> Result<Field>{Ok(Field::new(
field_args.name(),/* window function display name */DataType::UInt64,/* result data type */false/* row number is not nullable */))}}
/// Contains metadata necessary for defining the field which represents/// the final result of evaluating a user-defined window function.pubstructWindowUDFFieldArgs<'a>{/// The data types of input expressions to the user-defined window/// function.input_types:&'a[DataType],/// The display name of the user-defined window function.function_name:&'astr,}
Remove/Deprecate return_type trait method from WindowUDFImpl:
Is your feature request related to a problem or challenge?
Originally posted by @jayzhan211 in #12030 (comment)
This is a proposal to add a
field
trait method for implementing user-defined window functions. And also remove (or deprecate) the trait methodsreturn_type
andnullable
fromWindowUDFImpl
.Both the return data type and nullability of the result from evaluating the user-defined window function will be specified by the
field
implementation.Describe the solution you'd like
The current implementation for a user-defined window function (without
field
trait method) looks like this:The implementation for a user-defined window function after this change:
field
trait method toWindowUDFImpl
:WindowUDFFieldArgs
:Remove/Deprecate
return_type
trait method fromWindowUDFImpl
:datafusion/datafusion/expr/src/udwf.rs
Lines 282 to 284 in 502ce4b
Remove
nullable
trait method fromWindowUDFImpl
:datafusion/datafusion/expr/src/udwf.rs
Lines 347 to 354 in 502ce4b
Describe alternatives you've considered
Make no changes to
WindowUDFImpl
.Additional context
Part of #8709.
Follow up to #12030.
The text was updated successfully, but these errors were encountered: