dbms: uncomment clickhouse dictionary source creation [#METR-13298]

This commit is contained in:
Andrey Mironov 2015-02-04 16:06:56 +03:00
parent cee209db3e
commit ad54825dfe
2 changed files with 24 additions and 5 deletions

View File

@ -60,8 +60,8 @@ public:
}
else if (config.has(config_prefix + "clickhouse"))
{
return nullptr;//ext::make_unique<ClickhouseDictionarySource>(config, config_prefix + "clickhouse.",
//sample_block, context);
ext::make_unique<ClickhouseDictionarySource>(config, config_prefix + "clickhouse.",
sample_block, context);
}
throw Exception{"unsupported source type"};

View File

@ -7,11 +7,30 @@
namespace DB
{
namespace
{
std::string getDictionariesConfigPath(const Poco::Util::AbstractConfiguration & config)
{
const auto path = config.getString("dictionaries_config");
if (path.empty())
return path;
if (path[0] != '/')
{
const auto app_config_path = config.getString("config-file", "config.xml");
const auto config_dir = Poco::Path{app_config_path}.parent().toString();
const auto absolute_path = config_dir + path;
if (Poco::File{absolute_path}.exists())
return absolute_path;
}
return path;
}
}
void Dictionaries::reloadExternals()
{
const auto config_path = Poco::Util::Application::instance().config().getString("dictionaries_config");
if (config_path.empty())
return;
const auto config_path = getDictionariesConfigPath(Poco::Util::Application::instance().config());
const auto last_modified = Poco::File{config_path}.getLastModified();
if (last_modified > dictionaries_last_modified)