mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
|
#pragma once
|
||
|
|
||
|
#include <DB/Dictionaries/IDictionarySource.h>
|
||
|
|
||
|
namespace DB
|
||
|
{
|
||
|
|
||
|
|
||
|
/// Allows loading dictionaries from executable
|
||
|
class HTTPDictionarySource final : public IDictionarySource
|
||
|
{
|
||
|
static constexpr auto max_block_size = 8192;
|
||
|
|
||
|
public:
|
||
|
|
||
|
HTTPDictionarySource(const std::string & url, const std::string & format, Block & sample_block,
|
||
|
const Context & context);
|
||
|
|
||
|
HTTPDictionarySource(const HTTPDictionarySource & 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;
|
||
|
|
||
|
//DictionarySourcePtr clone() const override { return std::make_unique<HTTPDictionarySource>(*this); }
|
||
|
|
||
|
std::string toString() const override;
|
||
|
|
||
|
private:
|
||
|
Logger * log = &Logger::get("HTTPDictionarySource");
|
||
|
|
||
|
static std::string quoteForLike(const std::string s);
|
||
|
|
||
|
LocalDateTime getLastModification() const;
|
||
|
|
||
|
const std::string url;
|
||
|
const std::string format;
|
||
|
Block sample_block;
|
||
|
const Context & context;
|
||
|
const std::string load_all_query;
|
||
|
LocalDateTime last_modification;
|
||
|
};
|
||
|
|
||
|
}
|