From aea97ba9e47a732b10f9b9fec62e7d5f320a8b58 Mon Sep 17 00:00:00 2001 From: potya Date: Mon, 25 May 2020 20:10:44 +0300 Subject: [PATCH] Fix types and add complex test --- src/DataTypes/DataTypesNumber.cpp | 4 +- .../01268_data_numeric_parameters.reference | 3 ++ .../01268_data_numeric_parameters.sql | 42 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tests/queries/0_stateless/01268_data_numeric_parameters.reference create mode 100644 tests/queries/0_stateless/01268_data_numeric_parameters.sql diff --git a/src/DataTypes/DataTypesNumber.cpp b/src/DataTypes/DataTypesNumber.cpp index 3fbf81791dd..7fe6f64f6c6 100644 --- a/src/DataTypes/DataTypesNumber.cpp +++ b/src/DataTypes/DataTypesNumber.cpp @@ -46,8 +46,8 @@ void registerDataTypeNumbers(DataTypeFactory & factory) factory.registerDataType("Int16", createNumericDataType); factory.registerDataType("Int32", createNumericDataType); factory.registerDataType("Int64", createNumericDataType); - factory.registerDataType("Float32", createNumericDataType); - factory.registerDataType("Float64", createNumericDataType); + factory.registerDataType("Float32", createNumericDataType); + factory.registerDataType("Float64", createNumericDataType); /// These synonyms are added for compatibility. diff --git a/tests/queries/0_stateless/01268_data_numeric_parameters.reference b/tests/queries/0_stateless/01268_data_numeric_parameters.reference new file mode 100644 index 00000000000..fd76fd4ef54 --- /dev/null +++ b/tests/queries/0_stateless/01268_data_numeric_parameters.reference @@ -0,0 +1,3 @@ +Int8 Int8 Int16 Int16 Int32 Int32 Int64 Int64 +Float32 Float32 Float32 Float64 Float64 Float64 +String String diff --git a/tests/queries/0_stateless/01268_data_numeric_parameters.sql b/tests/queries/0_stateless/01268_data_numeric_parameters.sql new file mode 100644 index 00000000000..eceba51e7f5 --- /dev/null +++ b/tests/queries/0_stateless/01268_data_numeric_parameters.sql @@ -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;