2023-02-03 20:05:18 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Core/Field.h>
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
|
|
|
#include <Parsers/formatAST.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() const override { return serializeAST(*ast); }
|
|
|
|
|
2023-02-06 16:20:29 +00:00
|
|
|
[[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("=="); }
|
|
|
|
|
2023-02-03 20:05:18 +00:00
|
|
|
ASTPtr ast;
|
|
|
|
};
|
|
|
|
|
2023-02-04 12:49:32 +00:00
|
|
|
Field createFieldFromAST(ASTPtr ast);
|
2023-02-03 20:05:18 +00:00
|
|
|
|
|
|
|
}
|