1 | #include <DataTypes/DataTypesNumber.h> |
2 | #include <DataTypes/DataTypeFactory.h> |
3 | |
4 | |
5 | namespace DB |
6 | { |
7 | |
8 | template <typename NumberType> |
9 | static DataTypePtr create(const String & type_name) |
10 | { |
11 | return DataTypePtr(std::make_shared<NumberType>(type_name)); |
12 | } |
13 | |
14 | void registerDataTypeNumbers(DataTypeFactory & factory) |
15 | { |
16 | factory.registerSimpleDataType("UInt8" , create<DataTypeUInt8>); |
17 | factory.registerSimpleDataType("UInt16" , create<DataTypeUInt16>); |
18 | factory.registerSimpleDataType("UInt32" , create<DataTypeUInt32>); |
19 | factory.registerSimpleDataType("UInt64" , create<DataTypeUInt64>); |
20 | |
21 | factory.registerSimpleDataType("Int8" , create<DataTypeInt8>); |
22 | factory.registerSimpleDataType("Int16" , create<DataTypeInt16>); |
23 | factory.registerSimpleDataType("Int32" , create<DataTypeInt32>); |
24 | factory.registerSimpleDataType("Int64" , create<DataTypeInt64>); |
25 | |
26 | factory.registerSimpleDataType("Float32" , create<DataTypeFloat32>); |
27 | factory.registerSimpleDataType("Float64" , create<DataTypeFloat64>); |
28 | |
29 | /// These synonyms are added for compatibility. |
30 | |
31 | factory.registerAlias("TINYINT" , "Int8" , DataTypeFactory::CaseInsensitive); |
32 | factory.registerAlias("SMALLINT" , "Int16" , DataTypeFactory::CaseInsensitive); |
33 | factory.registerAlias("INT" , "Int32" , DataTypeFactory::CaseInsensitive); |
34 | factory.registerAlias("INTEGER" , "Int32" , DataTypeFactory::CaseInsensitive); |
35 | factory.registerAlias("BIGINT" , "Int64" , DataTypeFactory::CaseInsensitive); |
36 | factory.registerAlias("FLOAT" , "Float32" , DataTypeFactory::CaseInsensitive); |
37 | factory.registerAlias("DOUBLE" , "Float64" , DataTypeFactory::CaseInsensitive); |
38 | } |
39 | |
40 | } |
41 | |