From 9080d2ea528e0c30f96af4e49ebb8206cecb7552 Mon Sep 17 00:00:00 2001 From: kssenii Date: Mon, 1 Nov 2021 09:52:27 +0000 Subject: [PATCH] Fix tests --- src/Storages/ExternalDataSourceConfiguration.cpp | 2 +- src/Storages/StorageURL.cpp | 7 ++++--- src/Storages/StorageXDBC.cpp | 6 +++--- src/Storages/StorageXDBC.h | 2 -- src/TableFunctions/TableFunctionURL.cpp | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Storages/ExternalDataSourceConfiguration.cpp b/src/Storages/ExternalDataSourceConfiguration.cpp index dcdcb2cbefb..26a00b7cbed 100644 --- a/src/Storages/ExternalDataSourceConfiguration.cpp +++ b/src/Storages/ExternalDataSourceConfiguration.cpp @@ -332,7 +332,7 @@ std::optional getURLBasedDataSourceConfiguration(const if (arg_name == "url") configuration.url = arg_value.safeGet(); - if (arg_name == "method") + else if (arg_name == "method") configuration.http_method = arg_value.safeGet(); else if (arg_name == "format") configuration.format = arg_value.safeGet(); diff --git a/src/Storages/StorageURL.cpp b/src/Storages/StorageURL.cpp index ab1e9713701..fa55ddbcc7b 100644 --- a/src/Storages/StorageURL.cpp +++ b/src/Storages/StorageURL.cpp @@ -325,7 +325,7 @@ Pipe IStorageURLBase::read( { auto params = getReadURIParams(column_names, metadata_snapshot, query_info, local_context, processed_stage, max_block_size); bool with_globs = (uri.find('{') != std::string::npos && uri.find('}') != std::string::npos) - || uri.find('|') == std::string::npos; + || uri.find('|') != std::string::npos; if (with_globs) { @@ -390,6 +390,7 @@ Pipe StorageURLWithFailover::read( unsigned /*num_streams*/) { auto params = getReadURIParams(column_names, metadata_snapshot, query_info, local_context, processed_stage, max_block_size); + auto pipe = Pipe(std::make_shared( uri_options, getReadMethod(), @@ -473,8 +474,8 @@ StorageURLWithFailover::StorageURLWithFailover( { Poco::URI poco_uri(uri_option); context_->getRemoteHostFilter().checkURL(poco_uri); - uri_options.emplace_back(std::move(uri_option)); LOG_DEBUG(&Poco::Logger::get("StorageURLDistributed"), "Adding URL option: {}", uri_option); + uri_options.emplace_back(std::move(uri_option)); } } @@ -539,7 +540,7 @@ URLBasedDataSourceConfiguration StorageURL::getConfiguration(ASTs & args, Contex illegal_args += ", "; illegal_args += arg.first; } - throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown arguments {} for table function URL", illegal_args); + throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown argument `{}` for storage URL", illegal_args); } } else diff --git a/src/Storages/StorageXDBC.cpp b/src/Storages/StorageXDBC.cpp index 3ccde3a3597..90ac04ed250 100644 --- a/src/Storages/StorageXDBC.cpp +++ b/src/Storages/StorageXDBC.cpp @@ -47,7 +47,7 @@ StorageXDBC::StorageXDBC( , remote_table_name(remote_table_name_) , log(&Poco::Logger::get("Storage" + bridge_helper->getName())) { - poco_uri = bridge_helper->getMainURI(); + uri = bridge_helper->getMainURI().toString(); } std::string StorageXDBC::getReadMethod() const @@ -118,7 +118,7 @@ SinkToStoragePtr StorageXDBC::write(const ASTPtr & /*query*/, const StorageMetad { bridge_helper->startBridgeSync(); - Poco::URI request_uri = poco_uri; + auto request_uri = Poco::URI(uri); request_uri.setPath("/write"); auto url_params = bridge_helper->getURLParams(65536); @@ -137,7 +137,7 @@ SinkToStoragePtr StorageXDBC::write(const ASTPtr & /*query*/, const StorageMetad metadata_snapshot->getSampleBlock(), local_context, ConnectionTimeouts::getHTTPTimeouts(local_context), - chooseCompressionMethod(poco_uri.toString(), compression_method)); + chooseCompressionMethod(uri, compression_method)); } Block StorageXDBC::getHeaderBlock(const Names & column_names, const StorageMetadataPtr & metadata_snapshot) const diff --git a/src/Storages/StorageXDBC.h b/src/Storages/StorageXDBC.h index 34207dcbb4c..4438e1c4737 100644 --- a/src/Storages/StorageXDBC.h +++ b/src/Storages/StorageXDBC.h @@ -41,8 +41,6 @@ public: std::string getName() const override; private: - Poco::URI poco_uri; - BridgeHelperPtr bridge_helper; std::string remote_database_name; std::string remote_table_name; diff --git a/src/TableFunctions/TableFunctionURL.cpp b/src/TableFunctions/TableFunctionURL.cpp index 11c2d99de50..94e893466f6 100644 --- a/src/TableFunctions/TableFunctionURL.cpp +++ b/src/TableFunctions/TableFunctionURL.cpp @@ -45,7 +45,7 @@ void TableFunctionURL::parseArguments(const ASTPtr & ast_function, ContextPtr co illegal_args += ", "; illegal_args += arg.first; } - throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown arguments {} for table function URL", illegal_args); + throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown argument `{}` for table function URL", illegal_args); } filename = configuration.url;