Merge pull request #251 from proller/METR-23466

Dictonary: executable: rename 'path' to 'command' [#METR-23466]
This commit is contained in:
alexey-milovidov 2016-12-14 01:45:48 +04:00 committed by GitHub
commit 5af401721e
4 changed files with 9 additions and 9 deletions

View File

@ -40,7 +40,7 @@ private:
Logger * log = &Logger::get("ExecutableDictionarySource"); Logger * log = &Logger::get("ExecutableDictionarySource");
const DictionaryStructure dict_struct; const DictionaryStructure dict_struct;
const std::string path; const std::string command;
const std::string format; const std::string format;
Block sample_block; Block sample_block;
const Context & context; const Context & context;

View File

@ -17,7 +17,7 @@ ExecutableDictionarySource::ExecutableDictionarySource(const DictionaryStructure
const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix, const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix,
Block & sample_block, const Context & context) : Block & sample_block, const Context & context) :
dict_struct{dict_struct_}, dict_struct{dict_struct_},
path{config.getString(config_prefix + ".path")}, command{config.getString(config_prefix + ".command")},
format{config.getString(config_prefix + ".format")}, format{config.getString(config_prefix + ".format")},
sample_block{sample_block}, sample_block{sample_block},
context(context) context(context)
@ -26,7 +26,7 @@ ExecutableDictionarySource::ExecutableDictionarySource(const DictionaryStructure
ExecutableDictionarySource::ExecutableDictionarySource(const ExecutableDictionarySource & other) : ExecutableDictionarySource::ExecutableDictionarySource(const ExecutableDictionarySource & other) :
dict_struct{other.dict_struct}, dict_struct{other.dict_struct},
path{other.path}, command{other.command},
format{other.format}, format{other.format},
sample_block{other.sample_block}, sample_block{other.sample_block},
context(other.context) context(other.context)
@ -36,7 +36,7 @@ ExecutableDictionarySource::ExecutableDictionarySource(const ExecutableDictionar
BlockInputStreamPtr ExecutableDictionarySource::loadAll() BlockInputStreamPtr ExecutableDictionarySource::loadAll()
{ {
LOG_TRACE(log, "loadAll " + toString()); LOG_TRACE(log, "loadAll " + toString());
auto process = ShellCommand::execute(path); auto process = ShellCommand::execute(command);
auto stream = context.getInputFormat(format, process->out, sample_block, max_block_size); auto stream = context.getInputFormat(format, process->out, sample_block, max_block_size);
return std::make_shared<OwningBlockInputStream<ShellCommand>>(stream, std::move(process)); return std::make_shared<OwningBlockInputStream<ShellCommand>>(stream, std::move(process));
} }
@ -89,7 +89,7 @@ void columnsToBuffer(const Context & context, const std::string & format, Block
BlockInputStreamPtr ExecutableDictionarySource::loadIds(const std::vector<UInt64> & ids) BlockInputStreamPtr ExecutableDictionarySource::loadIds(const std::vector<UInt64> & ids)
{ {
LOG_TRACE(log, "loadIds " + toString() + " ids=" + std::to_string(ids.size())); LOG_TRACE(log, "loadIds " + toString() + " ids=" + std::to_string(ids.size()));
auto process = ShellCommand::execute(path); auto process = ShellCommand::execute(command);
idsToBuffer(context, format, sample_block, process->in, ids); idsToBuffer(context, format, sample_block, process->in, ids);
process->in.close(); process->in.close();
@ -107,7 +107,7 @@ BlockInputStreamPtr ExecutableDictionarySource::loadKeys(
const ConstColumnPlainPtrs & key_columns, const std::vector<std::size_t> & requested_rows) const ConstColumnPlainPtrs & key_columns, const std::vector<std::size_t> & requested_rows)
{ {
LOG_TRACE(log, "loadKeys " + toString() + " rows=" + std::to_string(requested_rows.size())); LOG_TRACE(log, "loadKeys " + toString() + " rows=" + std::to_string(requested_rows.size()));
auto process = ShellCommand::execute(path); auto process = ShellCommand::execute(command);
columnsToBuffer(context, format, sample_block, process->in, dict_struct, key_columns, requested_rows); columnsToBuffer(context, format, sample_block, process->in, dict_struct, key_columns, requested_rows);
process->in.close(); process->in.close();
@ -139,7 +139,7 @@ DictionarySourcePtr ExecutableDictionarySource::clone() const
std::string ExecutableDictionarySource::toString() const std::string ExecutableDictionarySource::toString() const
{ {
return "Executable: " + path; return "Executable: " + command;
} }
} }

View File

@ -6462,7 +6462,7 @@ The dictionary config file has the following format:
&lt;!-- or the source is a executable. If layout.complex_key_cache - list of needed keys will be written in STDIN of program --> &lt;!-- or the source is a executable. If layout.complex_key_cache - list of needed keys will be written in STDIN of program -->
&lt;executable> &lt;executable>
&lt;!-- Path on the local file system or name located in one of env PATH dirs. --> &lt;!-- Path on the local file system or name located in one of env PATH dirs. -->
&lt;path>cat /opt/dictionaries/os.tsv&lt;/path> &lt;command>cat /opt/dictionaries/os.tsv&lt;/command>
&lt;!-- Which format to use for reading/writing stream. --> &lt;!-- Which format to use for reading/writing stream. -->
&lt;format>TabSeparated&lt;/format> &lt;format>TabSeparated&lt;/format>
&lt;/executable> &lt;/executable>

View File

@ -6590,7 +6590,7 @@ regions_names_*.txt: TabSeparated (без заголовка), столбцы:
&lt;!-- или источник - исполняемый файл. Если layout.cache - список нужных ключей будет записан в поток STDIN программы --> &lt;!-- или источник - исполняемый файл. Если layout.cache - список нужных ключей будет записан в поток STDIN программы -->
&lt;executable> &lt;executable>
&lt;!-- Путь или имя программы (если директория есть в переменной окружения PATH) и параметры --> &lt;!-- Путь или имя программы (если директория есть в переменной окружения PATH) и параметры -->
&lt;path>cat /opt/dictionaries/os.tsv&lt;/path> &lt;command>cat /opt/dictionaries/os.tsv&lt;/command>
&lt;!-- С помощью какого формата понимать вывод и формировать список ключей. --> &lt;!-- С помощью какого формата понимать вывод и формировать список ключей. -->
&lt;format>TabSeparated&lt;/format> &lt;format>TabSeparated&lt;/format>
&lt;/executable> &lt;/executable>