Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
Similar to other issues in #8708
Remember to include test in roundtrip_expr_api
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
eejbyfeldt commentedon Jun 19, 2024
Will work on this one. I think it might also involve moving
nth_valuesince they shared some code.eejbyfeldt commentedon Jun 20, 2024
@jayzhan211 I pushed a work in progress here #11029 it still fails some test cases in sqllogictests
The first one seems to be because the new
NTH_VALUEUDAF is picked over the builtin window function with the same name. Is this expected? What is the correct course of action to resolve it?The second one looks a bit weird to me, not sure if I messed something up or I hitting some other issue.
@jayzhan211 If you have time to provide some pointers that would be highly appreciated :)
jayzhan211 commentedon Jun 20, 2024
I suggest we convert 1. ArrayAgg 2 DistinctArrayAgg, 3. OrderSensitiveArrayAgg and 3. NthValue separately.
OrderSensitiveArrayAggandNthValueare quite complex.jayzhan211 commentedon Jun 20, 2024
ArrayAgg and Nth expect to have parameter
nullable, we need to add it toAggregateFunctionExprso we can add it toStateFieldsArgsforstate_fieldsand change thenullableforfield.We can get
nullablewithdatafusion/datafusion/physical-expr/src/aggregate/build_in.rs
Line 71 in 58d23c5
https://github.com/apache/datafusion/blob/58d23c5c050f43aa7b867d4f0be7298d8d6cad83/datafusion/physical-expr-common/src/aggregate/mod.rs#L275C1-L289C6
eejbyfeldt commentedon Jun 20, 2024
Sounds good. If only converting
ArrayAgghow do one handle that there are multiple expressions using the same name? Should it not be registered? Or should I just leave the existing ArrayAgg code as is? The accumulator is private so it can not easily be reused, or is it acceptable to make it public in this intermediate state?eejbyfeldt commentedon Jun 20, 2024
Make sense. How come we only provide a single value for
input_type(https://github.com/apache/datafusion/blob/39.0.0/datafusion/physical-expr-common/src/aggregate/mod.rs#L245) can aggregates not have multiple inputs? Should the nullable field be justinput_nullable: boolor should it beinputs_nullable: Vec<bool>?jayzhan211 commentedon Jun 21, 2024
We have single input because we have not meet any function that need multiple input yet. If there is any function that expect multiple input, we can extend it to Vec
jayzhan211 commentedon Jun 21, 2024
We could check the
distinctandorderingto know whether we should use builtin or UDAF heredatafusion/datafusion/core/src/physical_planner.rs
Lines 1825 to 1909 in 18042fd
eejbyfeldt commentedon Jun 21, 2024
What about covariance: https://github.com/apache/datafusion/blob/main/datafusion/functions-aggregate/src/covariance.rs#L43 that takes 2 arguments.
eejbyfeldt commentedon Jun 21, 2024
@jayzhan211 Created a PR for only doning ArrayAgg here #11045 will look into adding
nullablenext.findepi commentedon Jul 5, 2024
array_agg is known to produce non-null result.
if we make it an UDAF, to avoid regression (if we choose so), we need a way for an UDAF to mark its output as non-null: #11274
jayzhan211 commentedon Jul 13, 2024
@eejbyfeldt Dp you plan to work on
array_agg?eejbyfeldt commentedon Jul 13, 2024
@jayzhan211 I will not be able to work on it for the two weeks due to being on vacation. So, someone else should feel to pick it up/take it over before then.
eejbyfeldt commentedon Aug 6, 2024
@jayzhan211 Should this be closed. Seems like it was resolved with #11448 ?
jayzhan211 commentedon Aug 6, 2024
Yes, all the functions are converted