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

Method getImpl

src/DataTypes/DataTypeFactory.cpp:120–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118
119template <bool nullptr_on_error>
120DataTypePtr DataTypeFactory::getImpl(const String & full_name) const
121{
122 /// Data type parser can be invoked from coroutines with small stack.
123 /// Value 315 is known to cause stack overflow in some test configurations (debug build, sanitizers)
124 /// let's make the threshold significantly lower.
125 /// It is impractical for user to have complex data types with this depth.
126
127#if defined(SANITIZER) || !defined(NDEBUG)
128 static constexpr size_t data_type_max_parse_depth = 150;
129#else
130 static constexpr size_t data_type_max_parse_depth = 300;
131#endif
132
133 ParserDataType parser;
134 ASTPtr ast;
135 if constexpr (nullptr_on_error)
136 {
137 String out_err;
138 const char * start = full_name.data();
139 ast = tryParseQuery(parser, start, start + full_name.size(), out_err, false, "data type", false,
140 DBMS_DEFAULT_MAX_QUERY_SIZE, data_type_max_parse_depth, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS, true);
141 if (!ast)
142 return nullptr;
143 }
144 else
145 {
146 ast = parseQuery(parser, full_name.data(), full_name.data() + full_name.size(), "data type", false, data_type_max_parse_depth, DBMS_DEFAULT_MAX_PARSER_BACKTRACKS);
147 }
148
149 return getImpl<nullptr_on_error>(ast);
150}
151
152DataTypePtr DataTypeFactory::get(const ASTPtr & ast) const
153{

Callers

nothing calls this directly

Calls 13

tryParseQueryFunction · 0.85
parseQueryFunction · 0.85
createEnumFromValuesFunction · 0.85
createTupleFromASTFunction · 0.85
addQueryFactoriesInfoMethod · 0.80
ExceptionClass · 0.50
dataMethod · 0.45
sizeMethod · 0.45
getArgumentsMethod · 0.45
nameMethod · 0.45
isNullMethod · 0.45
getIDMethod · 0.45

Tested by

no test coverage detected