Allow run query with remote() in clickhouse-local; Aloow redefine config from command line for clickhouse-local

This commit is contained in:
proller 2019-06-14 18:35:45 +03:00
parent f9cab91447
commit 7e7b5b3810
4 changed files with 12 additions and 1 deletions

View File

@ -34,6 +34,7 @@
#include <Dictionaries/registerDictionaries.h>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options.hpp>
#include <common/argsToConfig.h>
namespace DB
@ -497,6 +498,11 @@ void LocalServer::init(int argc, char ** argv)
config().setString("logger.level", options["logger.level"].as<std::string>());
if (options.count("ignore-error"))
config().setBool("ignore-error", true);
std::vector<std::string> arguments;
for (int arg_num = 1; arg_num < argc; ++arg_num)
arguments.emplace_back(argv[arg_num]);
argsToConfig(arguments, config(), 100);
}
void LocalServer::applyCmdOptions()

View File

@ -1524,7 +1524,7 @@ UInt16 Context::getTCPPort() const
auto lock = getLock();
auto & config = getConfigRef();
return config.getInt("tcp_port");
return config.getInt("tcp_port", DBMS_DEFAULT_PORT);
}
std::optional<UInt16> Context::getTCPPortSecure() const

View File

@ -9,3 +9,5 @@
0
0
0
1
1

View File

@ -24,3 +24,6 @@ $CLICKHOUSE_CLIENT -q "SELECT * FROM remote('${CLICKHOUSE_HOST}:${CLICKHOUSE_POR
$CLICKHOUSE_CLIENT -q "SELECT * FROM remote(test_shard_localhost, system, one);"
$CLICKHOUSE_CLIENT -q "SELECT * FROM remote(test_shard_localhost, system, one, 'default', '');"
$CLICKHOUSE_CLIENT -q "SELECT * FROM cluster('test_shard_localhost', system, one);"
$CLICKHOUSE_LOCAL --query "SELECT count() FROM remote('127.0.0.1', system.one)"
$CLICKHOUSE_LOCAL --query "SELECT count() FROM remote('127.0.0.1', system.one)" -- --tcp_port=59000