mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #251 from proller/METR-23466
Dictonary: executable: rename 'path' to 'command' [#METR-23466]
This commit is contained in:
commit
5af401721e
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6462,7 +6462,7 @@ The dictionary config file has the following format:
|
|||||||
<!-- or the source is a executable. If layout.complex_key_cache - list of needed keys will be written in STDIN of program -->
|
<!-- or the source is a executable. If layout.complex_key_cache - list of needed keys will be written in STDIN of program -->
|
||||||
<executable>
|
<executable>
|
||||||
<!-- Path on the local file system or name located in one of env PATH dirs. -->
|
<!-- Path on the local file system or name located in one of env PATH dirs. -->
|
||||||
<path>cat /opt/dictionaries/os.tsv</path>
|
<command>cat /opt/dictionaries/os.tsv</command>
|
||||||
<!-- Which format to use for reading/writing stream. -->
|
<!-- Which format to use for reading/writing stream. -->
|
||||||
<format>TabSeparated</format>
|
<format>TabSeparated</format>
|
||||||
</executable>
|
</executable>
|
||||||
|
@ -6590,7 +6590,7 @@ regions_names_*.txt: TabSeparated (без заголовка), столбцы:
|
|||||||
<!-- или источник - исполняемый файл. Если layout.cache - список нужных ключей будет записан в поток STDIN программы -->
|
<!-- или источник - исполняемый файл. Если layout.cache - список нужных ключей будет записан в поток STDIN программы -->
|
||||||
<executable>
|
<executable>
|
||||||
<!-- Путь или имя программы (если директория есть в переменной окружения PATH) и параметры -->
|
<!-- Путь или имя программы (если директория есть в переменной окружения PATH) и параметры -->
|
||||||
<path>cat /opt/dictionaries/os.tsv</path>
|
<command>cat /opt/dictionaries/os.tsv</command>
|
||||||
<!-- С помощью какого формата понимать вывод и формировать список ключей. -->
|
<!-- С помощью какого формата понимать вывод и формировать список ключей. -->
|
||||||
<format>TabSeparated</format>
|
<format>TabSeparated</format>
|
||||||
</executable>
|
</executable>
|
||||||
|
Loading…
Reference in New Issue
Block a user