Skip to content

Commit

Permalink
chore(stateless): add 11_data_type stateless category
Browse files Browse the repository at this point in the history
  • Loading branch information
BohuTANG committed Apr 17, 2022
1 parent d6fe2d1 commit 18d3fe8
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/doc/30-reference/10-data-types/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
select if(number, 3) from numbers(10); -- {ErrorCode 1028}
select parse_json(); -- {ErrorCode 1028}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-1 255
127 255
-128 0
Original file line number Diff line number Diff line change
@@ -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;
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 18d3fe8

Please sign in to comment.