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

#include <Parsers/IAST.h>

namespace DB
{

class ASTFunction;

/** name BY expr TYPE typename(args) GRANULARITY int in create query
  */
class ASTIndexDeclaration : public IAST
{
public:
    static const auto DEFAULT_INDEX_GRANULARITY = 1uz;
    static const auto DEFAULT_ANNOY_INDEX_GRANULARITY = 100'000'000uz;
    static const auto DEFAULT_USEARCH_INDEX_GRANULARITY = 100'000'000uz;

    String name;
    IAST * expr;
    ASTFunction * type;
    UInt64 granularity;
    bool part_of_create_index_query = false;

    /** Get the text that identifies this element. */
    String getID(char) const override { return "Index"; }

    ASTPtr clone() const override;
    void formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const override;

    void forEachPointerToChild(std::function<void(void**)> f) override
    {
        f(reinterpret_cast<void **>(&expr));
        f(reinterpret_cast<void **>(&type));
    }
};

}