MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / dataTypeToAST

Function dataTypeToAST

src/DataTypes/dataTypeToAST.cpp:17–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17boost::intrusive_ptr<ASTDataType> dataTypeToAST(const DataTypePtr & data_type)
18{
19 ParserDataType parser;
20 auto ast = parseQuery(parser, data_type->getName(), 0, DBMS_DEFAULT_MAX_PARSER_DEPTH, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS);
21
22 /// The dynamic cast is required here because ParserDataType can return
23 /// instance of a derived class, for example ASTTupleDataType.
24 auto ast_data_type = boost::dynamic_pointer_cast<ASTDataType>(ast);
25 if (!ast_data_type)
26 throw Exception(ErrorCodes::LOGICAL_ERROR,
27 "dataTypeToAST: unexpected AST node type for '{}'", data_type->getName());
28
29 return ast_data_type;
30}
31
32}

Callers 6

upgradeFromPrealphaFunction · 0.85
checkFunction · 0.85
formatColumnsMethod · 0.85

Calls 3

parseQueryFunction · 0.85
ExceptionClass · 0.50
getNameMethod · 0.45

Tested by 1

checkFunction · 0.68