| 234 | } |
| 235 | |
| 236 | static DataTypePtr create(const ASTPtr & arguments) |
| 237 | { |
| 238 | if (!arguments || arguments->children.size() != 2) |
| 239 | throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Map data type family must have two arguments: key and value types"); |
| 240 | |
| 241 | DataTypes nested_types; |
| 242 | nested_types.reserve(arguments->children.size()); |
| 243 | |
| 244 | for (const ASTPtr & child : arguments->children) |
| 245 | nested_types.emplace_back(DataTypeFactory::instance().get(child)); |
| 246 | |
| 247 | return std::make_shared<DataTypeMap>(nested_types); |
| 248 | } |
| 249 | |
| 250 | |
| 251 | void registerDataTypeMap(DataTypeFactory & factory) |