aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Parsers/FieldFromAST.h
blob: a69c086a1709aa4e458f408db30b675dbf407fd4 (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
#pragma once
#include <Core/Field.h>
#include <Parsers/IAST_fwd.h>

namespace DB
{

struct FieldFromASTImpl : public CustomType::CustomTypeImpl
{
    static constexpr auto name = "AST";

    explicit FieldFromASTImpl(ASTPtr ast_) : ast(ast_) {}

    const char * getTypeName() const override { return name; }
    String toString(bool show_secrets) const override;
    bool isSecret() const override;

    [[noreturn]] void throwNotImplemented(std::string_view method) const;

    bool operator < (const CustomTypeImpl &) const override { throwNotImplemented("<"); }
    bool operator <= (const CustomTypeImpl &) const override { throwNotImplemented("<="); }
    bool operator > (const CustomTypeImpl &) const override { throwNotImplemented(">"); }
    bool operator >= (const CustomTypeImpl &) const override { throwNotImplemented(">="); }
    bool operator == (const CustomTypeImpl &) const override { throwNotImplemented("=="); }

    ASTPtr ast;
};

Field createFieldFromAST(ASTPtr ast);

}