ClickHouse/tests/queries/0_stateless/00721_force_by_identical_result_after_merge_zookeeper.sql

19 lines
916 B
MySQL
Raw Normal View History

DROP TABLE IF EXISTS byte_identical_r1;
DROP TABLE IF EXISTS byte_identical_r2;
2018-09-21 16:43:44 +00:00
CREATE TABLE byte_identical_r1(x UInt32) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/byte_identical', 'r1') ORDER BY x;
CREATE TABLE byte_identical_r2(x UInt32) ENGINE ReplicatedMergeTree('/clickhouse/tables/test/byte_identical', 'r2') ORDER BY x;
2018-09-21 16:43:44 +00:00
INSERT INTO byte_identical_r1(x) VALUES (1), (2), (3);
SYSTEM SYNC REPLICA byte_identical_r2;
2018-09-21 16:43:44 +00:00
-- Add a column with a default expression that will yield different values on different replicas.
-- Call optimize to materialize it. Replicas should compare checksums and restore consistency.
2020-02-20 09:22:17 +00:00
ALTER TABLE byte_identical_r1 ADD COLUMN y UInt64 DEFAULT rand();
OPTIMIZE TABLE byte_identical_r1 PARTITION tuple() FINAL;
2018-09-21 16:43:44 +00:00
2019-12-02 18:07:27 +00:00
SELECT x, t1.y - t2.y FROM byte_identical_r1 t1 SEMI LEFT JOIN byte_identical_r2 t2 USING x ORDER BY x;
2018-09-21 16:43:44 +00:00
DROP TABLE byte_identical_r1;
DROP TABLE byte_identical_r2;