-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(udf): POC faster min max accumulator #12677
base: main
Are you sure you want to change the base?
Conversation
|
||
let input_array = &values[0]; | ||
|
||
for (i, &group_index) in group_indices.iter().enumerate() { |
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 think much of the filter logic is handled by accumulate_indices
datafusion/datafusion/functions-aggregate/src/count.rs
Lines 417 to 424 in f54712d
accumulate_indices( | |
group_indices, | |
values.logical_nulls().as_ref(), | |
opt_filter, | |
|group_index| { | |
self.counts[group_index] += 1; | |
}, | |
); |
You could likely avoid much of this repetition (and likely it would be faster)
It woudl also be nice to avoid the duplication between min /max by using generics. Here is how the primitive one does it (passes in a comparison function)
https://github.com/apache/datafusion/blob/main/datafusion/functions-aggregate/src/min_max.rs#L119
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.
Thanks @devanbenz -- I think this is on the right track
What I suggest is:
- We start with
StringArray
(rather than StringViewArray) - Run some benchmarks (clickbench) -- I can do this if it would help
All in all, thanks again
@alamb thanks for taking a peek. Will go ahead and implement this for |
BTW here is an example of using a const generic: #12703 |
Which issue does this PR close?
Closes #6906
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?