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

Function create

src/DataTypes/DataTypeString.cpp:41–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41static DataTypePtr create(const ASTPtr & arguments)
42{
43 if (arguments && !arguments->children.empty())
44 {
45 if (arguments->children.size() > 1)
46 {
47 throw Exception(
48 ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
49 "String data type family mustn't have more than one argument - size in characters");
50 }
51
52 const auto * argument = arguments->children[0]->as<ASTLiteral>();
53 if (!argument || argument->value.getType() != Field::Types::UInt64)
54 {
55 throw Exception(
56 ErrorCodes::UNEXPECTED_AST_STRUCTURE, "String data type family may have only a number (positive integer) as its argument");
57 }
58 }
59
60 return std::make_shared<DataTypeString>();
61}
62
63void registerDataTypeString(DataTypeFactory & factory)
64{

Callers 2

createColumnMethod · 0.70
doGetSerializationMethod · 0.70

Calls 4

ExceptionClass · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected