Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(stateless): add 11_data_type stateless category #4892

Merged
merged 1 commit into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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.