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

#include <Interpreters/WindowDescription.h>

#include <Parsers/IAST.h>


namespace DB
{

struct ASTWindowDefinition : public IAST
{
    std::string parent_window_name;

    ASTPtr partition_by;

    ASTPtr order_by;

    bool frame_is_default = true;
    WindowFrame::FrameType frame_type = WindowFrame::FrameType::RANGE;
    WindowFrame::BoundaryType frame_begin_type = WindowFrame::BoundaryType::Unbounded;
    ASTPtr frame_begin_offset;
    bool frame_begin_preceding = true;
    WindowFrame::BoundaryType frame_end_type = WindowFrame::BoundaryType::Current;
    ASTPtr frame_end_offset;
    bool frame_end_preceding = false;

    ASTPtr clone() const override;

    String getID(char delimiter) const override;

    void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;

    std::string getDefaultWindowName() const;
};

struct ASTWindowListElement : public IAST
{
    String name;

    // ASTWindowDefinition
    ASTPtr definition;


    ASTPtr clone() const override;

    String getID(char delimiter) const override;

    void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
};

}