This commit is contained in:
Alexander Tokmakov 2021-08-20 17:05:53 +03:00
parent 8c6dd18917
commit 42378b5913
4 changed files with 11 additions and 8 deletions

View File

@ -327,11 +327,13 @@ StorageDistributed::StorageDistributed(
const String & relative_data_path_,
const DistributedSettings & distributed_settings_,
bool attach_,
ClusterPtr owned_cluster_)
ClusterPtr owned_cluster_,
ASTPtr remote_table_function_ptr_)
: IStorage(id_)
, WithContext(context_->getGlobalContext())
, remote_database(remote_database_)
, remote_table(remote_table_)
, remote_table_function_ptr(remote_table_function_ptr_)
, log(&Poco::Logger::get("StorageDistributed (" + id_.table_name + ")"))
, owned_cluster(std::move(owned_cluster_))
, cluster_name(getContext()->getMacros()->expand(cluster_name_))
@ -402,9 +404,9 @@ StorageDistributed::StorageDistributed(
relative_data_path_,
distributed_settings_,
attach,
std::move(owned_cluster_))
std::move(owned_cluster_),
remote_table_function_ptr_)
{
remote_table_function_ptr = std::move(remote_table_function_ptr_);
}
QueryProcessingStage::Enum StorageDistributed::getQueryProcessingStage(

View File

@ -136,7 +136,8 @@ private:
const String & relative_data_path_,
const DistributedSettings & distributed_settings_,
bool attach_,
ClusterPtr owned_cluster_ = {});
ClusterPtr owned_cluster_ = {},
ASTPtr remote_table_function_ptr_ = {});
StorageDistributed(
const StorageID & id_,

View File

@ -4,8 +4,7 @@ DROP TABLE IF EXISTS distr2;
CREATE TABLE distr (x UInt8) ENGINE = Distributed(test_shard_localhost, currentDatabase(), distr); -- { serverError 269 }
CREATE TABLE distr0 (x UInt8) ENGINE = Distributed(test_shard_localhost, '', distr0);
SELECT * FROM distr0; -- { serverError 581 }
CREATE TABLE distr0 (x UInt8) ENGINE = Distributed(test_shard_localhost, '', distr0); -- { serverError 269 }
CREATE TABLE distr1 (x UInt8) ENGINE = Distributed(test_shard_localhost, currentDatabase(), distr2);
CREATE TABLE distr2 (x UInt8) ENGINE = Distributed(test_shard_localhost, currentDatabase(), distr1);
@ -13,6 +12,5 @@ CREATE TABLE distr2 (x UInt8) ENGINE = Distributed(test_shard_localhost, current
SELECT * FROM distr1; -- { serverError 581 }
SELECT * FROM distr2; -- { serverError 581 }
DROP TABLE distr0;
DROP TABLE distr1;
DROP TABLE distr2;

View File

@ -9,7 +9,9 @@ CREATE TABLE tt6
`status` String
)
ENGINE = Distributed('test_shard_localhost', '', 'tt6', rand());
ENGINE = Distributed('test_shard_localhost', '', 'tt7', rand());
CREATE TABLE tt7 as tt6 ENGINE = Distributed('test_shard_localhost', '', 'tt6', rand());
INSERT INTO tt6 VALUES (1, 1, 1, 1, 'ok'); -- { serverError 581 }