mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 05:52:05 +00:00
27 lines
537 B
C++
27 lines
537 B
C++
|
#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); }
|
||
|
|
||
|
ASTPtr ast;
|
||
|
};
|
||
|
|
||
|
Field createFieldFromAST(ASTPtr ast)
|
||
|
{
|
||
|
return CustomType(std::make_shared<FieldFromASTImpl>(ast));
|
||
|
}
|
||
|
|
||
|
}
|