diff --git a/docs/doc/30-reference/10-data-types/index.md b/docs/doc/30-reference/10-data-types/index.md index aad7c7533271..d3aa7353dbaa 100644 --- a/docs/doc/30-reference/10-data-types/index.md +++ b/docs/doc/30-reference/10-data-types/index.md @@ -15,12 +15,12 @@ Databend supports SQL data types in several categories: | Data Type | Syntax | Size(byte) | Min Value | Max Value | Format | | ----------|----------------------| --------- | ---------------------- | ----------- | -------| | Int8 | TINYINT | 1 | -128 | 127 | -| Int16 | SMALLINT | 2 | -32768 | 32767 | -| Int32 | INT | 4 | -2147483648 | 2147483647 | -| Int64 | BIGINT | 8 | -9223372036854775808 | 9223372036854775807 | | UInt8 | TINYINT UNSIGNED | 1 | 0 | 255 | +| Int16 | SMALLINT | 2 | -32768 | 32767 | | UInt16 | SMALLINT UNSIGNED | 2 | 0 | 65535 | +| Int32 | INT | 4 | -2147483648 | 2147483647 | | UInt32 | INT UNSIGNED | 4 | 0 | 4294967295 | +| Int64 | BIGINT | 8 | -9223372036854775808 | 9223372036854775807 | | UInt64 | BIGINT UNSIGNED | 8 | 0 | 18446744073709551615 | | Float32 | FLOAT | 4 | -3.40282347e+38 | 3.40282347e+38 | | Float64 | DOUBLE | 8 | -1.7976931348623157E+308 | 1.7976931348623157E+308 | diff --git a/tests/suites/0_stateless/02_function/02_0053_function_argument_check.result b/tests/suites/0_stateless/02_function/02_0053_function_argument_check.result new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/02_function/02_0053_function_argument_check.sql b/tests/suites/0_stateless/02_function/02_0053_function_argument_check.sql new file mode 100644 index 000000000000..5728cd7ab383 --- /dev/null +++ b/tests/suites/0_stateless/02_function/02_0053_function_argument_check.sql @@ -0,0 +1,2 @@ +select if(number, 3) from numbers(10); -- {ErrorCode 1028} +select parse_json(); -- {ErrorCode 1028} diff --git a/tests/suites/0_stateless/11_data_type/11_0000_data_type_numeric.result b/tests/suites/0_stateless/11_data_type/11_0000_data_type_numeric.result new file mode 100644 index 000000000000..83449c22c418 --- /dev/null +++ b/tests/suites/0_stateless/11_data_type/11_0000_data_type_numeric.result @@ -0,0 +1,3 @@ +-1 255 +127 255 +-128 0 diff --git a/tests/suites/0_stateless/11_data_type/11_0000_data_type_numeric.sql b/tests/suites/0_stateless/11_data_type/11_0000_data_type_numeric.sql new file mode 100644 index 000000000000..cc939f3940b3 --- /dev/null +++ b/tests/suites/0_stateless/11_data_type/11_0000_data_type_numeric.sql @@ -0,0 +1,31 @@ +-- For each data type: +-- 1) bound check +-- 2) conversion check +-- 3) group by check +CREATE DATABASE IF NOT EXISTS data_type; +USE data_type; + +DROP TABLE IF EXISTS t; +CREATE TABLE t(tiny TINYINT, tiny_unsigned TINYINT UNSIGNED); + +-- low bound check +INSERT INTO t VALUES (-1, -1); +SELECT * FROM t; + +-- group by check +-- https://github.com/datafuselabs/databend/issues/4891 +SELECT sum(tiny) FROM t GROUP BY tiny; + +-- low bound check +TRUNCATE TABLE t; +INSERT INTO t VALUES (-129, -1); +SELECT * FROM t; + +-- upper bound check +TRUNCATE TABLE t; +INSERT INTO t VALUES (128, 256); +SELECT * FROM t; + +-- others(TODO) + +DROP DATABASE data_type; diff --git a/tests/suites/0_stateless/11_data_type/11_0001_data_type_date_time.result b/tests/suites/0_stateless/11_data_type/11_0001_data_type_date_time.result new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0001_data_type_date_time.sql b/tests/suites/0_stateless/11_data_type/11_0001_data_type_date_time.sql new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0002_data_type_string.result b/tests/suites/0_stateless/11_data_type/11_0002_data_type_string.result new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0002_data_type_string.sql b/tests/suites/0_stateless/11_data_type/11_0002_data_type_string.sql new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0003_data_type_logical.result b/tests/suites/0_stateless/11_data_type/11_0003_data_type_logical.result new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0003_data_type_logical.sql b/tests/suites/0_stateless/11_data_type/11_0003_data_type_logical.sql new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0004_data_type_semi_structured.result b/tests/suites/0_stateless/11_data_type/11_0004_data_type_semi_structured.result new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/suites/0_stateless/11_data_type/11_0004_data_type_semi_structured.sql b/tests/suites/0_stateless/11_data_type/11_0004_data_type_semi_structured.sql new file mode 100644 index 000000000000..e69de29bb2d1