aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Interpreters/NormalizeSelectWithUnionQueryVisitor.h
blob: e8194f0dfe155d05a9d0aa3bdee6443e814fc74d (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
#pragma once

#include <unordered_set>

#include <Interpreters/InDepthNodeVisitor.h>
#include <Parsers/IAST_fwd.h>

#include <Core/Settings.h>

namespace DB
{

class ASTFunction;
class ASTSelectWithUnionQuery;

class NormalizeSelectWithUnionQueryMatcher
{
public:
    struct Data
    {
        const SetOperationMode union_default_mode;
    };

    static void getSelectsFromUnionListNode(ASTPtr ast_select, ASTs & selects);

    static void visit(ASTPtr & ast, Data &);
    static void visit(ASTSelectWithUnionQuery &, Data &);
    static bool needChildVisit(const ASTPtr &, const ASTPtr &) { return true; }
};

/// We need normalize children first, so we should visit AST tree bottom up
using NormalizeSelectWithUnionQueryVisitor
    = InDepthNodeVisitor<NormalizeSelectWithUnionQueryMatcher, false>;
}