ClickHouse/src/Dictionaries/ExecutableDictionarySource.h

65 lines
1.8 KiB
C++
Raw Normal View History

2016-11-15 19:51:06 +00:00
#pragma once
#include "DictionaryStructure.h"
#include "IDictionarySource.h"
#include <Core/Block.h>
#include <Interpreters/Context.h>
namespace Poco { class Logger; }
2016-11-15 19:51:06 +00:00
namespace DB
{
2019-03-01 16:38:52 +00:00
2016-11-15 19:51:06 +00:00
/// Allows loading dictionaries from executable
class ExecutableDictionarySource final : public IDictionarySource
{
public:
ExecutableDictionarySource(
const DictionaryStructure & dict_struct_,
const Poco::Util::AbstractConfiguration & config,
const std::string & config_prefix,
2019-08-03 11:02:40 +00:00
Block & sample_block_,
ContextPtr context_);
2016-11-15 19:51:06 +00:00
ExecutableDictionarySource(const ExecutableDictionarySource & other);
2019-07-08 00:51:43 +00:00
ExecutableDictionarySource & operator=(const ExecutableDictionarySource &) = delete;
2016-11-15 19:51:06 +00:00
BlockInputStreamPtr loadAll() override;
2016-11-15 19:51:06 +00:00
2019-03-01 16:38:52 +00:00
/** The logic of this method is flawed, absolutely incorrect and ignorant.
* It may lead to skipping some values due to clock sync or timezone changes.
* The intended usage of "update_field" is totally different.
*/
BlockInputStreamPtr loadUpdatedAll() override;
BlockInputStreamPtr loadIds(const std::vector<UInt64> & ids) override;
2016-11-15 19:51:06 +00:00
BlockInputStreamPtr loadKeys(const Columns & key_columns, const std::vector<size_t> & requested_rows) override;
2016-11-15 19:51:06 +00:00
bool isModified() const override;
2016-11-15 19:51:06 +00:00
bool supportsSelectiveLoad() const override;
2016-11-15 19:51:06 +00:00
bool hasUpdateField() const override;
DictionarySourcePtr clone() const override;
2016-11-15 19:51:06 +00:00
std::string toString() const override;
2016-11-15 19:51:06 +00:00
2021-02-28 21:04:05 +00:00
BlockInputStreamPtr getStreamForBlock(const Block & block);
2016-11-15 19:51:06 +00:00
private:
Poco::Logger * log;
2019-03-01 16:38:52 +00:00
time_t update_time = 0;
const DictionaryStructure dict_struct;
bool implicit_key;
const std::string command;
const std::string update_field;
const std::string format;
Block sample_block;
ContextPtr context;
2016-11-15 19:51:06 +00:00
};
}