-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add topKWeighted aggregate function #4245
Add topKWeighted aggregate function #4245
Conversation
if (set.capacity() != AggregateFunctionTopK<T>::reserved) | ||
set.resize(AggregateFunctionTopK<T>::reserved); | ||
set.insert(static_cast<const ColumnVector<T> &>(*columns[0]).getData()[row_num], | ||
static_cast<const ColumnVector<T> &>(*columns[1]).getData()[row_num]); |
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.
Function arguments can have different types.
try SELECT topKWeighted(10)(number, number % 100) FROM numbers(1000)
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.
Minor changes required.
@@ -48,16 +48,21 @@ static IAggregateFunction * createWithExtraTypes(const DataTypePtr & argument_ty | |||
return new AggregateFunctionTopKGeneric<false>(threshold, argument_type); | |||
} | |||
|
|||
template<bool weighed> |
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.
Typo.
It doesn't work for generic types:
|
Merged. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Category (leave one):
Short description (up to few sentences):
Added
topKWeighted
aggregate function that takes additional argument with (unsigned integer) weight.