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

Insert into ClickHouse table which use ENGINE = Distributed causes incorrect result #7600

Open
lupengfei-johnson opened this issue Apr 15, 2021 · 6 comments
Labels
bug Something isn't working correctness

Comments

@lupengfei-johnson
Copy link

lupengfei-johnson commented Apr 15, 2021

clickhouse.testdb.test5 uses ENGINE = Distributed , there is 1 row in it.
trino> select * from clickhouse.testdb.test5;
eventdate | counterid | userid | appid
-------------------------+-----------+--------+-------
2021-04-15 19:00:00.000 | 123 | 123 | 123
(1 row)

Insert another row to it
trino> insert into clickhouse.testdb.test5 values(timestamp '2021-04-15 20:00:00',12345,123,123);
INSERT: 1 row

but there is 4 rows in the table.
trino> select * from clickhouse.testdb.test5;
eventdate | counterid | userid | appid
-------------------------+-----------+--------+-------
2021-04-15 19:00:00.000 | 123 | 123 | 123
2021-04-15 19:00:00.000 | 123 | 123 | 123
2021-04-15 20:00:00.000 | 12345 | 123 | 123
2021-04-15 20:00:00.000 | 12345 | 123 | 123
(4 rows)

@findepi findepi added the bug Something isn't working label Apr 15, 2021
@findepi
Copy link
Member

findepi commented Apr 15, 2021

cc @wgzhao

@wgzhao
Copy link
Member

wgzhao commented Apr 16, 2021

@lupengfei-johnson Similar to #7601, the Distributed Table Engine involves multi-node data sharding, and currently the clickhouse connector does not support distributed clickhouse writes

@nikita-sheremet-java-developer
Copy link

nikita-sheremet-java-developer commented Jan 23, 2025

I have exact the same problem. But when inserttions are done by Spark there are no doubles. So it look like some trino settings are wrong.

@wgzhao
I also appologies if I'm bothering you, but what do think about this?

@wgzhao
Copy link
Member

wgzhao commented Jan 24, 2025

which version you are testing?

@nikita-sheremet-java-developer

@wgzhao
Trino 464
ClickHouse 23.8.16.16

@wgzhao
Copy link
Member

wgzhao commented Jan 26, 2025

Could you describe the ClickHouse deployment environment in detail?
How many nodes are being used, and what is the data replication mode between the nodes?
Is it replica or shard?
Please provide the detailed table creation statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness
Development

No branches or pull requests

4 participants