ClickHouse/dbms/include/DB/Dictionaries/ExecutableDictionarySource.h

55 lines
1.6 KiB
C++
Raw Normal View History

2016-11-15 19:51:06 +00:00
#pragma once
#include <DB/Dictionaries/IDictionarySource.h>
2016-11-18 01:48:13 +00:00
#include <DB/Dictionaries/DictionaryStructure.h>
2016-11-15 19:51:06 +00:00
namespace DB
{
/// Allows loading dictionaries from executable
class ExecutableDictionarySource final : public IDictionarySource
{
public:
2016-11-24 01:01:11 +00:00
ExecutableDictionarySource(
const DictionaryStructure & dict_struct_,
const Poco::Util::AbstractConfiguration & config,
const std::string & config_prefix,
2016-11-22 15:03:54 +00:00
Block & sample_block,
2016-11-24 01:01:11 +00:00
const Context & context
);
2016-11-15 19:51:06 +00:00
ExecutableDictionarySource(const ExecutableDictionarySource & other);
BlockInputStreamPtr loadAll() override;
BlockInputStreamPtr loadIds(const std::vector<UInt64> & ids) override;
BlockInputStreamPtr loadKeys(
const ConstColumnPlainPtrs & key_columns, const std::vector<std::size_t> & requested_rows) override;
bool isModified() const override;
bool supportsSelectiveLoad() const override;
DictionarySourcePtr clone() const override;
std::string toString() const override;
private:
Logger * log = &Logger::get("ExecutableDictionarySource");
2016-11-18 01:48:13 +00:00
const DictionaryStructure dict_struct;
const std::string command;
2016-11-15 19:51:06 +00:00
const std::string format;
Block sample_block;
const Context & context;
};
2016-11-27 13:01:35 +00:00
void idsToBuffer(const Context & context, const std::string & format, Block & sample_block, WriteBuffer & out_stream,
const std::vector<UInt64> & ids);
void columnsToBuffer(const Context & context, const std::string & format, Block & sample_block, WriteBuffer & out_buffer,
const DictionaryStructure & dict_struct, const ConstColumnPlainPtrs & key_columns, const std::vector<std::size_t> & requested_rows);
2016-11-15 19:51:06 +00:00
}