ClickHouse/tests/queries/0_stateless/02536_distributed_detach_table.sql
AVMusorin 99329d8682 Improve tests for Distributed INSERT
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-02-28 23:17:37 +01:00

17 lines
651 B
SQL

-- test detach distributed table with pending files
CREATE TABLE test_02536 (n Int8) ENGINE=MergeTree() ORDER BY tuple();
CREATE TABLE test_dist_02536 (n Int8) ENGINE=Distributed(test_cluster_two_shards, currentDatabase(), test_02536, rand());
SYSTEM STOP DISTRIBUTED SENDS test_dist_02536;
INSERT INTO test_dist_02536 SELECT number FROM numbers(5) SETTINGS prefer_localhost_replica=0;
SELECT count(n), sum(n) FROM test_dist_02536; -- 0 0
DETACH TABLE test_dist_02536;
ATTACH TABLE test_dist_02536;
SYSTEM FLUSH DISTRIBUTED test_dist_02536;
SELECT count(n), sum(n) FROM test_dist_02536; -- 10 20
DROP TABLE test_02536;
DROP TABLE test_dist_02536;