ClickHouse/src/Dictionaries/RedisDictionarySource.h

58 lines
1.6 KiB
C++
Raw Normal View History

2019-01-15 22:08:56 +00:00
#pragma once
2019-05-26 12:58:40 +00:00
#include <Core/Block.h>
#include <base/BorrowedObjectPool.h>
#include "DictionaryStructure.h"
#include "IDictionarySource.h"
2023-05-20 03:48:57 +00:00
#include <Storages/RedisCommon.h>
2019-01-15 22:08:56 +00:00
namespace DB
{
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
}
2019-01-15 22:08:56 +00:00
class RedisDictionarySource final : public IDictionarySource
{
public:
RedisDictionarySource(
2022-01-20 14:55:56 +00:00
const DictionaryStructure & dict_struct_,
2023-05-20 03:48:57 +00:00
const RedisConfiguration & configuration_,
2022-01-20 14:55:56 +00:00
const Block & sample_block_);
2019-01-15 22:08:56 +00:00
RedisDictionarySource(const RedisDictionarySource & other);
~RedisDictionarySource() override;
2022-05-20 19:49:31 +00:00
QueryPipeline loadAll() override;
2019-01-15 22:08:56 +00:00
2022-05-20 19:49:31 +00:00
QueryPipeline loadUpdatedAll() override
2019-01-15 22:08:56 +00:00
{
2021-04-10 18:48:36 +00:00
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method loadUpdatedAll is unsupported for RedisDictionarySource");
2019-01-15 22:08:56 +00:00
}
bool supportsSelectiveLoad() const override { return true; }
2022-05-20 19:49:31 +00:00
QueryPipeline loadIds(const std::vector<UInt64> & ids) override;
2019-01-15 22:08:56 +00:00
2022-05-20 19:49:31 +00:00
QueryPipeline loadKeys(const Columns & key_columns, const std::vector<size_t> & requested_rows) override;
2019-01-15 22:08:56 +00:00
bool isModified() const override { return true; }
bool hasUpdateField() const override { return false; }
DictionarySourcePtr clone() const override { return std::make_shared<RedisDictionarySource>(*this); }
2019-01-15 22:08:56 +00:00
std::string toString() const override;
2019-04-16 23:13:07 +00:00
private:
2019-01-15 22:08:56 +00:00
const DictionaryStructure dict_struct;
2023-05-20 03:48:57 +00:00
const RedisConfiguration configuration;
2019-01-15 22:08:56 +00:00
2023-05-20 03:48:57 +00:00
RedisPoolPtr pool;
Block sample_block;
2019-01-15 22:08:56 +00:00
};
}