| 63 | |
| 64 | |
| 65 | static DataTypePtr create(const ASTPtr & arguments) |
| 66 | { |
| 67 | if (!arguments || arguments->children.size() != 1) |
| 68 | throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, |
| 69 | "FixedString data type family must have exactly one argument - size in bytes"); |
| 70 | |
| 71 | const auto * argument = arguments->children[0]->as<ASTLiteral>(); |
| 72 | if (!argument || argument->value.getType() != Field::Types::UInt64 || argument->value.safeGet<UInt64>() == 0) |
| 73 | throw Exception(ErrorCodes::UNEXPECTED_AST_STRUCTURE, |
| 74 | "FixedString data type family must have a number (positive integer) as its argument"); |
| 75 | |
| 76 | return std::make_shared<DataTypeFixedString>(argument->value.safeGet<UInt64>()); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | void registerDataTypeFixedString(DataTypeFactory & factory) |
no test coverage detected