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

Aggregate function states addition [CLICKHOUSE-3723] #3062

Merged
merged 11 commits into from
Sep 8, 2018
Merged

Aggregate function states addition [CLICKHOUSE-3723] #3062

merged 11 commits into from
Sep 8, 2018

Conversation

CurtizJ
Copy link
Member

@CurtizJ CurtizJ commented Sep 6, 2018

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

for (size_t i = 0; i < 2; ++i)
columns[i] = typeid_cast<const ColumnAggregateFunction *>(block.getByPosition(arguments[i]).column.get());

auto arena = std::make_shared<Arena>();
Copy link
Member

Choose a reason for hiding this comment

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

.

auto & vec_to = column_to->getData();
auto & vec_from = column_from->getData();

UInt64 m = block.getByPosition(new_arguments[1]).column->getUInt(0);
Copy link
Member

Choose a reason for hiding this comment

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

How do you check that the argument is constant?
(Need to add a test when it is not.)

What if block has size number of rows?


if (!new_arguments[0]->equals(*new_arguments[1]))
throw Exception("Cannot add aggregate states of different functions: "
+ new_arguments[0]->getFunctionName() + " and " + new_arguments[1]->getFunctionName(), ErrorCodes::CANNOT_ADD_DIFFERENT_AGGREGATE_STATES);
Copy link
Member

Choose a reason for hiding this comment

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

The error message will be misleading when you try to add uniqUpTo(5) and uniqUpTo(10).

throw Exception("Cannot add aggregate states of different functions: "
+ new_arguments[0]->getFunctionName() + " and " + new_arguments[1]->getFunctionName(), ErrorCodes::CANNOT_ADD_DIFFERENT_AGGREGATE_STATES);

if (!new_arguments[0]->getReturnType()->equals(*new_arguments[1]->getReturnType().get()))
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this check?

@alexey-milovidov alexey-milovidov merged commit 8dcf593 into ClickHouse:master Sep 8, 2018
alexey-milovidov added a commit that referenced this pull request Sep 8, 2018
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.

2 participants