Skip to content

Commit

Permalink
Merge pull request #4892 from BohuTANG/dev-function-argument-check
Browse files Browse the repository at this point in the history
chore(stateless): add 11_data_type stateless category
  • Loading branch information
BohuTANG authored Apr 17, 2022
2 parents f8e4cc3 + 18d3fe8 commit a0b9686
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.

1 comment on commit a0b9686

@vercel
Copy link

@vercel vercel bot commented on a0b9686 Apr 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend-git-main-databend.vercel.app
databend.rs
databend.vercel.app
databend-databend.vercel.app

Please sign in to comment.