aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Dictionaries/NullDictionarySource.cpp
blob: 45dcc77f93d0aa656c0fcaafc45db52cb60cdc7e (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
#include "NullDictionarySource.h"
#include <Interpreters/Context.h>
#include <Processors/Sources/NullSource.h>
#include <Common/logger_useful.h>
#include "DictionarySourceFactory.h"
#include "DictionarySourceHelpers.h"
#include "DictionaryStructure.h"
#include "registerDictionaries.h"


namespace DB
{
NullDictionarySource::NullDictionarySource(Block & sample_block_) : sample_block(sample_block_)
{
}

NullDictionarySource::NullDictionarySource(const NullDictionarySource & other) : sample_block(other.sample_block)
{
}

QueryPipeline NullDictionarySource::loadAll()
{
    LOG_TRACE(&Poco::Logger::get("NullDictionarySource"), "loadAll {}", toString());
    return QueryPipeline(std::make_shared<NullSource>(sample_block));
}


std::string NullDictionarySource::toString() const
{
    return "Null";
}


void registerDictionarySourceNull(DictionarySourceFactory & factory)
{
    auto create_table_source
        = [=](const DictionaryStructure & /* dict_struct */,
              const Poco::Util::AbstractConfiguration & /* config */,
              const std::string & /* config_prefix */,
              Block & sample_block,
              ContextPtr /* global_context */,
              const std::string & /* default_database */,
              bool /* created_from_ddl*/) -> DictionarySourcePtr { return std::make_unique<NullDictionarySource>(sample_block); };

    factory.registerSource("null", create_table_source);
}

}