Fix types and add complex test

This commit is contained in:
potya 2020-05-25 20:10:44 +03:00
parent 927de75a47
commit aea97ba9e4
3 changed files with 47 additions and 2 deletions

View File

@ -46,8 +46,8 @@ void registerDataTypeNumbers(DataTypeFactory & factory)
factory.registerDataType("Int16", createNumericDataType<Int16>);
factory.registerDataType("Int32", createNumericDataType<Int32>);
factory.registerDataType("Int64", createNumericDataType<Int64>);
factory.registerDataType("Float32", createNumericDataType<Int32>);
factory.registerDataType("Float64", createNumericDataType<Int64>);
factory.registerDataType("Float32", createNumericDataType<Float32>);
factory.registerDataType("Float64", createNumericDataType<Float64>);
/// These synonyms are added for compatibility.

View File

@ -0,0 +1,3 @@
Int8 Int8 Int16 Int16 Int32 Int32 Int64 Int64
Float32 Float32 Float32 Float64 Float64 Float64
String String

View File

@ -0,0 +1,42 @@
DROP TABLE IF EXISTS ints;
DROP TABLE IF EXISTS floats;
DROP TABLE IF EXISTS strings;
CREATE TABLE ints (
a TINYINT,
b TINYINT(8),
c SMALLINT,
d SMALLINT(16),
e INT,
f INT(32),
g BIGINT,
h BIGINT(64)
) engine=Memory;
INSERT INTO ints VALUES (1, 8, 11, 16, 21, 32, 41, 64);
SELECT toTypeName(a), toTypeName(b), toTypeName(c), toTypeName(d), toTypeName(e), toTypeName(f), toTypeName(g), toTypeName(h) FROM ints;
CREATE TABLE floats (
a FLOAT,
b FLOAT(12),
c FLOAT(15, 22),
d DOUBLE,
e DOUBLE(12),
f DOUBLE(4, 18)
) engine=Memory;
INSERT INTO floats VALUES (1.1, 1.2, 1.3, 41.1, 41.1, 42.1);
SELECT toTypeName(a), toTypeName(b), toTypeName(c), toTypeName(d), toTypeName(e), toTypeName(f) FROM floats;
CREATE TABLE strings (
a VARCHAR,
b VARCHAR(11)
) engine=Memory;
INSERT INTO strings VALUES ('test', 'string');
SELECT toTypeName(a), toTypeName(b) FROM strings;