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

With sum for example: sumMerge accepts sumState instead of sum #69509

Closed
alsugiliazova opened this issue Sep 11, 2024 · 5 comments
Closed

With sum for example: sumMerge accepts sumState instead of sum #69509

alsugiliazova opened this issue Sep 11, 2024 · 5 comments

Comments

@alsugiliazova
Copy link
Contributor

create table t (a Int32) engine= MergeTree order by tuple();

insert into t values (3), (4);

select hex(sumState(a)) from t;

SELECT sumMerge(CAST(unhex('0700000000000000'), 'AggregateFunction(sumState, Int32)'));

24.8 output:

0700000000000000
7

I expect to see (behavior before 22.8):

Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Illegal type AggregateFunction(sumState, Int32) of argument for aggregate function with Merge suffix, because it corresponds to different aggregate function: sumState instead of sum. (ILLEGAL_TYPE_OF_ARGUMENT)
(query: SELECT sumMerge(CAST(unhex('0700000000000000'), 'AggregateFunction(sumState, Int32)'));)

What had caused this change in behaviour?

@Algunenano
Copy link
Member

I don't understand what's unexpected about being able to merge sumState.

@alsugiliazova
Copy link
Contributor Author

Because you can not have a value of type AggregateFunction(sumState, Int64) as I know. And the state (result of sumState) is from sum function, not from sumState (then it would be sumStateState).

@UnamedRus
Copy link
Contributor

sumState

SELECT toTypeName(sumState(1))

Query id: c65b8646-bd1a-415f-8448-fefa66cb36d9

┌─toTypeName(sumState(1))───────┐
│ AggregateFunction(sum, UInt8) │
└───────────────────────────────┘

@Algunenano
Copy link
Member

sumState is the aggregate function state of sum.

@den-crane
Copy link
Contributor

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

No branches or pull requests

4 participants