v.22.8Improvement
Normalize AggregateFunction Types and State Representations for Optimization Compatibility
NormalizeAggregateFunctiontypes and state representations because optimizations like #35788 will treatcount(not null columns)ascount(), which might confuses distributed interpreters with the following error :Conversion from AggregateFunction(count) to AggregateFunction(count, Int64) is not supported. #39420 (Amos Bird). The functions with identical states can be used in materialized views interchangeably.
Why it matters
This feature addresses issues where optimizations such as treatingcount(not null columns) as count() caused errors in distributed query interpreters, like the error Conversion from AggregateFunction(count) to AggregateFunction(count, Int64) is not supported. By normalizing the AggregateFunction types and states, it ensures compatibility and interchangeability of functions with identical states, especially useful for materialized views.How to use it
No explicit user action is required. The normalization is applied internally toAggregateFunction types and state representations, allowing users to freely use aggregate functions with identical states in materialized views and distributed queries without encountering conversion errors.