Add test with different databases.

This commit is contained in:
Nikolai Kochetov 2022-10-17 19:05:15 +00:00
parent 0de06f59b1
commit f67b5182ea
3 changed files with 24 additions and 1 deletions

View File

@ -106,7 +106,7 @@ ContextMutablePtr updateSettingsForCluster(const Cluster & cluster, ContextPtr c
if (query_info && query_info->additional_filter_ast)
{
Tuple tuple;
tuple.push_back(main_table.getFullTableName());
tuple.push_back(main_table.getShortName());
tuple.push_back(queryToString(query_info->additional_filter_ast));
new_settings.additional_table_filters.value.push_back(std::move(tuple));
}

View File

@ -0,0 +1,3 @@
4 dddd
5 a
6 bb

View File

@ -0,0 +1,20 @@
-- Tags: no-parallel, distributed
create database if not exists shard_0;
create database if not exists shard_1;
drop table if exists dist_02346;
drop table if exists shard_0.data_02346;
drop table if exists shard_1.data_02346;
create table shard_0.data_02346 (x UInt32, y String) engine = MergeTree order by x settings index_granularity = 2;
insert into shard_0.data_02346 values (1, 'a'), (2, 'bb'), (3, 'ccc'), (4, 'dddd');
create table shard_1.data_02346 (x UInt32, y String) engine = MergeTree order by x settings index_granularity = 2;
insert into shard_1.data_02346 values (5, 'a'), (6, 'bb'), (7, 'ccc'), (8, 'dddd');
create table dist_02346 (x UInt32, y String) engine=Distributed('test_cluster_two_shards_different_databases', /* default_database= */ '', data_02346);
set max_rows_to_read=4;
select * from dist_02346 order by x settings additional_table_filters={'dist_02346' : 'x > 3 and x < 7'};