aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Parsers/ParserTablesInSelectQuery.h
blob: 428b14826633ee36d37ece577a8f4607ffa24619 (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
#pragma once

#include <Parsers/IParserBase.h>


namespace DB
{

struct ASTTableJoin;

/** List of single or multiple JOIN-ed tables or subqueries in SELECT query, with ARRAY JOINs and SAMPLE, FINAL modifiers.
  */
class ParserTablesInSelectQuery : public IParserBase
{
public:
    explicit ParserTablesInSelectQuery(bool allow_alias_without_as_keyword_ = true)
        : allow_alias_without_as_keyword(allow_alias_without_as_keyword_) {}

protected:
    const char * getName() const override { return "table, table function, subquery or list of joined tables"; }
    bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;

private:
    bool allow_alias_without_as_keyword;
};


class ParserTablesInSelectQueryElement : public IParserBase
{
public:
    explicit ParserTablesInSelectQueryElement(bool is_first_, bool allow_alias_without_as_keyword_ = true)
        : is_first(is_first_), allow_alias_without_as_keyword(allow_alias_without_as_keyword_) {}

protected:
    const char * getName() const override { return "table, table function, subquery or list of joined tables"; }
    bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;

private:
    bool is_first;
    bool allow_alias_without_as_keyword;

    static void parseJoinStrictness(Pos & pos, ASTTableJoin & table_join);
};


class ParserTableExpression : public IParserBase
{
public:
    explicit ParserTableExpression(bool allow_alias_without_as_keyword_ = true)
        : allow_alias_without_as_keyword(allow_alias_without_as_keyword_) {}

protected:
    const char * getName() const override { return "table or subquery or table function"; }
    bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;

private:
    bool allow_alias_without_as_keyword;
};


class ParserArrayJoin : public IParserBase
{
protected:
    const char * getName() const override { return "array join"; }
    bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
};


}