This commit is contained in:
Alexander Tokmakov 2021-04-14 14:07:56 +03:00
parent fdf3cf378f
commit c34e27ed1c
3 changed files with 3 additions and 4 deletions

View File

@ -6,7 +6,5 @@ CREATE TABLE shard_0.demo_loan_01568\n(\n `id` Int64 COMMENT \'id\',\n `da
CREATE TABLE shard_1.demo_loan_01568\n(\n `id` Int64 COMMENT \'id\',\n `date_stat` Date COMMENT \'date of stat\',\n `customer_no` String COMMENT \'customer no\',\n `loan_principal` Float64 COMMENT \'loan principal\'\n)\nENGINE = ReplacingMergeTree\nPARTITION BY toYYYYMM(date_stat)\nORDER BY id\nSETTINGS index_granularity = 8192 CREATE TABLE shard_1.demo_loan_01568\n(\n `id` Int64 COMMENT \'id\',\n `date_stat` Date COMMENT \'date of stat\',\n `customer_no` String COMMENT \'customer no\',\n `loan_principal` Float64 COMMENT \'loan principal\'\n)\nENGINE = ReplacingMergeTree\nPARTITION BY toYYYYMM(date_stat)\nORDER BY id\nSETTINGS index_granularity = 8192
1 2021-04-13 qwerty 3.14159 1 2021-04-13 qwerty 3.14159
2 2021-04-14 asdfgh 2.71828 2 2021-04-14 asdfgh 2.71828
1 2021-04-13 qwerty 3.14159
2 2021-04-14 asdfgh 2.71828
2 2021-04-14 asdfgh 2.71828 2 2021-04-14 asdfgh 2.71828
1 2021-04-13 qwerty 3.14159 1 2021-04-13 qwerty 3.14159

View File

@ -1,15 +1,16 @@
DROP DATABASE IF EXISTS shard_0; DROP DATABASE IF EXISTS shard_0;
DROP DATABASE IF EXISTS shard_1; DROP DATABASE IF EXISTS shard_1;
SET distributed_ddl_output_mode='none';
DROP TABLE IF EXISTS demo_loan_01568_dist; DROP TABLE IF EXISTS demo_loan_01568_dist;
CREATE DATABASE shard_0; CREATE DATABASE shard_0;
CREATE DATABASE shard_1; CREATE DATABASE shard_1;
SET distributed_ddl_output_mode='none';
CREATE TABLE demo_loan_01568 ON CLUSTER test_cluster_two_shards_different_databases ( `id` Int64 COMMENT 'id', `date_stat` Date COMMENT 'date of stat', `customer_no` String COMMENT 'customer no', `loan_principal` Float64 COMMENT 'loan principal' ) ENGINE=ReplacingMergeTree() ORDER BY id PARTITION BY toYYYYMM(date_stat); -- { serverError 371 } CREATE TABLE demo_loan_01568 ON CLUSTER test_cluster_two_shards_different_databases ( `id` Int64 COMMENT 'id', `date_stat` Date COMMENT 'date of stat', `customer_no` String COMMENT 'customer no', `loan_principal` Float64 COMMENT 'loan principal' ) ENGINE=ReplacingMergeTree() ORDER BY id PARTITION BY toYYYYMM(date_stat); -- { serverError 371 }
SET distributed_ddl_output_mode='throw'; SET distributed_ddl_output_mode='throw';
CREATE TABLE shard_0.demo_loan_01568 ON CLUSTER test_cluster_two_shards_different_databases ( `id` Int64 COMMENT 'id', `date_stat` Date COMMENT 'date of stat', `customer_no` String COMMENT 'customer no', `loan_principal` Float64 COMMENT 'loan principal' ) ENGINE=ReplacingMergeTree() ORDER BY id PARTITION BY toYYYYMM(date_stat); CREATE TABLE shard_0.demo_loan_01568 ON CLUSTER test_cluster_two_shards_different_databases ( `id` Int64 COMMENT 'id', `date_stat` Date COMMENT 'date of stat', `customer_no` String COMMENT 'customer no', `loan_principal` Float64 COMMENT 'loan principal' ) ENGINE=ReplacingMergeTree() ORDER BY id PARTITION BY toYYYYMM(date_stat);
CREATE TABLE shard_1.demo_loan_01568 ON CLUSTER test_cluster_two_shards_different_databases ( `id` Int64 COMMENT 'id', `date_stat` Date COMMENT 'date of stat', `customer_no` String COMMENT 'customer no', `loan_principal` Float64 COMMENT 'loan principal' ) ENGINE=ReplacingMergeTree() ORDER BY id PARTITION BY toYYYYMM(date_stat); CREATE TABLE shard_1.demo_loan_01568 ON CLUSTER test_cluster_two_shards_different_databases ( `id` Int64 COMMENT 'id', `date_stat` Date COMMENT 'date of stat', `customer_no` String COMMENT 'customer no', `loan_principal` Float64 COMMENT 'loan principal' ) ENGINE=ReplacingMergeTree() ORDER BY id PARTITION BY toYYYYMM(date_stat);
SET distributed_ddl_output_mode='none';
SHOW TABLES FROM shard_0; SHOW TABLES FROM shard_0;
SHOW TABLES FROM shard_1; SHOW TABLES FROM shard_1;
@ -18,7 +19,6 @@ SHOW CREATE TABLE shard_1.demo_loan_01568;
CREATE TABLE demo_loan_01568_dist AS shard_0.demo_loan_01568 ENGINE=Distributed('test_cluster_two_shards_different_databases', '', 'demo_loan_01568', id % 2); CREATE TABLE demo_loan_01568_dist AS shard_0.demo_loan_01568 ENGINE=Distributed('test_cluster_two_shards_different_databases', '', 'demo_loan_01568', id % 2);
INSERT INTO demo_loan_01568_dist VALUES (1, '2021-04-13', 'qwerty', 3.14159), (2, '2021-04-14', 'asdfgh', 2.71828); INSERT INTO demo_loan_01568_dist VALUES (1, '2021-04-13', 'qwerty', 3.14159), (2, '2021-04-14', 'asdfgh', 2.71828);
SELECT * FROM demo_loan_01568_dist ORDER BY id;
SYSTEM FLUSH DISTRIBUTED demo_loan_01568_dist; SYSTEM FLUSH DISTRIBUTED demo_loan_01568_dist;
SELECT * FROM demo_loan_01568_dist ORDER BY id; SELECT * FROM demo_loan_01568_dist ORDER BY id;

View File

@ -557,6 +557,7 @@
"01135_default_and_alter_zookeeper", "01135_default_and_alter_zookeeper",
"01148_zookeeper_path_macros_unfolding", "01148_zookeeper_path_macros_unfolding",
"01150_ddl_guard_rwr", "01150_ddl_guard_rwr",
"01152_cross_replication",
"01185_create_or_replace_table", "01185_create_or_replace_table",
"01190_full_attach_syntax", "01190_full_attach_syntax",
"01191_rename_dictionary", "01191_rename_dictionary",