合并 Clickhouse 中的 uniqMerge 值

Merge uniqMerge Values in Clickhouse

我在架构 tags

中有两条记录
CREATE TABLE default.tags
(
    `tag_id` String,
    `count` SimpleAggregateFunction(sum, Int64),
    `users` AggregateFunction(uniq, String),
    `sessions` AggregateFunction(uniq, String)
)

我想将所有用户合并到一条记录中。我试过 uniqState(users) 但它给了我 AggregateFunction(uniq, AggregateFunction(uniq, String)).

类型的东西

你需要使用uniqMerge函数uniqMerge(users) https://clickhouse.tech/docs/en/sql-reference/aggregate-functions/combinators/#aggregate_functions_combinators-merge

https://kb.altinity.com/altinity-kb-queries-and-syntax/state-and-merge-combinators