aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Core/InterpolateDescription.cpp
blob: e7b74716b794efab682d5f4411659fc61074f5ea (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
#include <Core/Block.h>
#include <IO/Operators.h>
#include <Common/JSONBuilder.h>
#include <Core/InterpolateDescription.h>
#include <Interpreters/convertFieldToType.h>

namespace DB
{

    InterpolateDescription::InterpolateDescription(ActionsDAGPtr actions_, const Aliases & aliases)
        : actions(actions_)
    {
        for (const auto & name_type : actions->getRequiredColumns())
        {
            if (const auto & p = aliases.find(name_type.name); p != aliases.end())
                required_columns_map[p->second->getColumnName()] = name_type;
            else
                required_columns_map[name_type.name] = name_type;
        }

        for (const ColumnWithTypeAndName & column : actions->getResultColumns())
        {
            std::string name = column.name;
            if (const auto & p = aliases.find(name); p != aliases.end())
                name = p->second->getColumnName();

            result_columns_set.insert(name);
            result_columns_order.push_back(name);
        }
    }

}