timeplus-io / proton

A stream processing engine and database, and a fast and lightweight alternative to ksqlDB and Apache Flink, 🚀 powered by ClickHouse
https://timeplus.com
Apache License 2.0
1.58k stars 69 forks source link

Remain problem existed in multi shards distinct #830

Closed Jasmine-ge closed 2 months ago

Jasmine-ge commented 2 months ago

Describe what's wrong

client@1:
create stream if not exists test13_multishard_7(id int, val int) settings shards=3, sharding_expr='to_int(id)'
client@1:
select sum_distinct(val), sum(val) from test13_multishard_7 emit periodic 1ms
client@2:
insert into test13_multishard_7(id, val) values(1, 30), (2, 30)

Error message and/or stacktrace

c1 :) select sum_distinct(val), sum(val) from v2

SELECT
  sum_distinct(val), sum(val)
FROM
  test13_multishard_7
EMIT STREAM PERIODIC 1ms

Query id: 01f530a6-e045-481f-b7d2-8f8518e5e886

┌─sum_distinct(val)─┬─sum(val)─┐
│                 0 │       60 │
└───────────────────┴──────────┘