ClickHouse/dbms/src/Dictionaries/ExecutableDictionarySource.h

63 lines
1.7 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>
2016-11-15 19:51:06 +00:00
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,
Block & sample_block,
const Context & 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
private:
Poco::Logger * log;
2016-11-15 19:51:06 +00:00
2019-03-01 16:38:52 +00:00
time_t update_time = 0;
const DictionaryStructure dict_struct;
const std::string command;
const std::string update_field;
const std::string format;
Block sample_block;
const Context & context;
2016-11-15 19:51:06 +00:00
};
}