aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/System/StorageSystemMacros.cpp
blob: 576fbc69039326534829e79771e3b072de5e8683 (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
#include <Common/Macros.h>
#include <Interpreters/Context.h>
#include <Storages/System/StorageSystemMacros.h>


namespace DB
{

NamesAndTypesList StorageSystemMacros::getNamesAndTypes()
{
    return {
        {"macro", std::make_shared<DataTypeString>()},
        {"substitution", std::make_shared<DataTypeString>()},
    };
}

void StorageSystemMacros::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const
{
    auto macros = context->getMacros();

    for (const auto & macro : macros->getMacroMap())
    {
        res_columns[0]->insert(macro.first);
        res_columns[1]->insert(macro.second);
    }
}

}