This commit is contained in:
proller 2016-11-24 01:44:53 +03:00
parent c919c02ed4
commit 8f573d7308
4 changed files with 9 additions and 15 deletions

View File

@ -40,9 +40,8 @@ private:
Logger * log = &Logger::get("ExecutableDictionarySource");
const DictionaryStructure dict_struct;
const std::string name;
const std::string path;
const std::string format;
const bool selective;
Block sample_block;
const Context & context;
};

View File

@ -47,7 +47,6 @@ private:
const std::string path;
//const std::string method;
const std::string format;
const bool selective;
Block sample_block;
const Context & context;

View File

@ -14,9 +14,8 @@ ExecutableDictionarySource::ExecutableDictionarySource(const DictionaryStructure
const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix,
Block & sample_block, const Context & context) :
dict_struct{dict_struct_},
name{config.getString(config_prefix + ".name")},
path{config.getString(config_prefix + ".path")},
format{config.getString(config_prefix + ".format")},
selective{!config.getString(config_prefix + ".selective", "").empty()}, // todo! how to correct?
sample_block{sample_block},
context(context)
{
@ -24,9 +23,8 @@ ExecutableDictionarySource::ExecutableDictionarySource(const DictionaryStructure
ExecutableDictionarySource::ExecutableDictionarySource(const ExecutableDictionarySource & other) :
dict_struct{other.dict_struct},
name{other.name},
path{other.path},
format{other.format},
selective{other.selective},
sample_block{other.sample_block},
context(other.context)
{
@ -35,7 +33,7 @@ ExecutableDictionarySource::ExecutableDictionarySource(const ExecutableDictionar
BlockInputStreamPtr ExecutableDictionarySource::loadAll()
{
LOG_TRACE(log, "loadAll " + toString());
auto process = ShellCommand::execute(name);
auto process = ShellCommand::execute(path);
auto stream = context.getInputFormat(format, process->out, sample_block, max_block_size);
return std::make_shared<OwningBlockInputStream<ShellCommand>>(stream, std::move(process));
}
@ -43,7 +41,7 @@ BlockInputStreamPtr ExecutableDictionarySource::loadAll()
BlockInputStreamPtr ExecutableDictionarySource::loadIds(const std::vector<UInt64> & ids)
{
LOG_TRACE(log, "loadIds " + toString());
auto process = ShellCommand::execute(name);
auto process = ShellCommand::execute(path);
{
ColumnWithTypeAndName column;
@ -77,7 +75,7 @@ BlockInputStreamPtr ExecutableDictionarySource::loadKeys(
const ConstColumnPlainPtrs & key_columns, const std::vector<std::size_t> & requested_rows)
{
LOG_TRACE(log, "loadKeys " + toString());
auto process = ShellCommand::execute(name);
auto process = ShellCommand::execute(path);
{
Block block;
@ -119,7 +117,7 @@ bool ExecutableDictionarySource::isModified() const
bool ExecutableDictionarySource::supportsSelectiveLoad() const
{
return selective;
return true;
}
DictionarySourcePtr ExecutableDictionarySource::clone() const
@ -129,7 +127,7 @@ DictionarySourcePtr ExecutableDictionarySource::clone() const
std::string ExecutableDictionarySource::toString() const
{
return "Executable: " + name;
return "Executable: " + path;
}
}

View File

@ -22,7 +22,6 @@ HTTPDictionarySource::HTTPDictionarySource(const DictionaryStructure & dict_stru
path{config.getString(config_prefix + ".path", "")},
//method{config.getString(config_prefix + ".method", "")},
format{config.getString(config_prefix + ".format")},
selective{!config.getString(config_prefix + ".selective", "").empty()}, // todo! how to correct?
sample_block{sample_block},
context(context)
{
@ -34,7 +33,6 @@ HTTPDictionarySource::HTTPDictionarySource(const HTTPDictionarySource & other) :
port{other.port},
path{other.path},
format{other.format},
selective{other.selective},
sample_block{other.sample_block},
context(other.context)
{
@ -125,7 +123,7 @@ bool HTTPDictionarySource::isModified() const
bool HTTPDictionarySource::supportsSelectiveLoad() const
{
return selective;
return true;
}
DictionarySourcePtr HTTPDictionarySource::clone() const