Skip to content
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

Move-away "uniqCombined" as a separate aggregated function #3406

Merged
merged 20 commits into from Nov 22, 2018

Conversation

abyss7
Copy link
Contributor

@abyss7 abyss7 commented Oct 17, 2018

Accepts single param - the HLL precision.

AggregateFunctionPtr createAggregateFunctionUniqCombined(
const std::string & name, const DataTypes & argument_types, const Array & params)
{
UInt8 precision = 17; /// default value - must correlate with default ctor of |AggregateFunctionUniqCombinedData|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it MUST be correlated it's better to set named constant and use it both here and in ctor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It correlates with a hardcoded union member initialization, the constant won't help - so I left the comment. The code now looks like: AggregateFunctionUniqCombinedDataWithKey() : set_17() {} - Also I can use a macro-definition as constant, if it's better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is there should be only one place there magic number 17 set.

SELECT Y, uniqCombined(X) FROM (SELECT number AS X, (3*X*X - 7*X + 11) % 37 AS Y FROM system.numbers LIMIT 15) GROUP BY Y;
SELECT Y, uniqCombined(X) FROM (SELECT number AS X, (3*X*X - 7*X + 11) % 37 AS Y FROM system.numbers LIMIT 3000) GROUP BY Y;
SELECT Y, uniqCombined(X) FROM (SELECT number AS X, (3*X*X - 7*X + 11) % 37 AS Y FROM system.numbers LIMIT 1000000) GROUP BY Y;
SELECT Y, uniqCombined(15)(X) FROM (SELECT number AS X, (3*X*X - 7*X + 11) % 37 AS Y FROM system.numbers LIMIT 15) GROUP BY Y;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it change default behavior? What if someone already use uniqCombined without parameter. Would he (or she :) ) get the same values after update?

@alexey-milovidov alexey-milovidov merged commit 89e3c5c into ClickHouse:master Nov 22, 2018
alexey-milovidov added a commit that referenced this pull request Nov 22, 2018
alexey-milovidov added a commit that referenced this pull request Nov 23, 2018
@alexey-milovidov
Copy link
Member

https://gist.github.com/alexey-milovidov/9cbbc2916f8d946594049d424487e458

Now the uniqHLL12 function can be considered obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants