mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 20:12:02 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
27 lines
643 B
C++
27 lines
643 B
C++
#include "addTypeConversionToAST.h"
|
|
|
|
#include <Parsers/ASTLiteral.h>
|
|
#include <Parsers/ASTFunction.h>
|
|
#include <Parsers/ASTExpressionList.h>
|
|
#include <Parsers/ASTWithAlias.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
ASTPtr addTypeConversionToAST(ASTPtr && ast, const String & type_name)
|
|
{
|
|
auto func = makeASTFunction("CAST", ast, std::make_shared<ASTLiteral>(type_name));
|
|
|
|
if (ASTWithAlias * ast_with_alias = dynamic_cast<ASTWithAlias *>(ast.get()))
|
|
{
|
|
func->alias = ast_with_alias->alias;
|
|
func->prefer_alias_to_column_name = ast_with_alias->prefer_alias_to_column_name;
|
|
ast_with_alias->alias.clear();
|
|
}
|
|
|
|
return func;
|
|
}
|
|
|
|
}
|