aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Dictionaries/YAMLRegExpTreeDictionarySource.h
blob: bd2f034e2bd50ee0fe155e63d961a4bf71d670f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#pragma once

#include <Common/Exception.h>

#include "clickhouse_config.h"

#include <Core/Block.h>
#include <Interpreters/Context_fwd.h>
#include <QueryPipeline/QueryPipeline.h>

#include <Poco/Logger.h>
#include <Poco/Timestamp.h>

#include <Dictionaries/IDictionarySource.h>
#include <Dictionaries/DictionaryStructure.h>

namespace DB
{

namespace ErrorCodes
{
    extern const int NOT_IMPLEMENTED;
}

class YAMLRegExpTreeDictionarySource : public IDictionarySource
{
#if USE_YAML_CPP
public:
    YAMLRegExpTreeDictionarySource(const String & filepath_, const DictionaryStructure & dict_struct_, ContextPtr context_, bool created_from_ddl);

    YAMLRegExpTreeDictionarySource(const YAMLRegExpTreeDictionarySource & other);

    QueryPipeline loadAll() override;

    QueryPipeline loadUpdatedAll() override
    {
        throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method loadUpdatedAll is unsupported for YAMLRegExpTreeDictionarySource");
    }

    QueryPipeline loadIds(const std::vector<UInt64> &) override
    {
        throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method loadIds is unsupported for YAMLRegExpTreeDictionarySource");
    }

    QueryPipeline loadKeys(const Columns &, const std::vector<size_t> &) override
    {
        throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method loadKeys is unsupported for YAMLRegExpTreeDictionarySource");
    }

    bool supportsSelectiveLoad() const override { return false; }

    bool hasUpdateField() const override { return false; }

    DictionarySourcePtr clone() const override { return std::make_shared<YAMLRegExpTreeDictionarySource>(*this); }

    bool isModified() const override;

    String toString() const override;

private:
    const String filepath;
    String key_name;
    const DictionaryStructure structure;

    ContextPtr context;

    Poco::Logger * logger;
    Poco::Timestamp last_modification;

    Poco::Timestamp getLastModification() const;
#endif
};

}