Skip to content

Commit

Permalink
tests: integrationtest support report warnings (#47010)
Browse files Browse the repository at this point in the history
ref #45961
  • Loading branch information
Defined2014 authored Sep 19, 2023
1 parent bb49dc1 commit 7d71771
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 137 deletions.
Binary file modified tests/integrationtest/r/expression/builtin.result
Binary file not shown.
10 changes: 5 additions & 5 deletions tests/integrationtest/r/expression/cast.result
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
select cast('' as signed);
cast('' as signed)
0
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: ''
select cast('12345abcde' as signed);
cast('12345abcde' as signed)
12345
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '12345abcde'
select cast('123e456' as signed);
cast('123e456' as signed)
123
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '123e456'
select cast('-12345abcde' as signed);
cast('-12345abcde' as signed)
-12345
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '-12345abcde'
select cast('-123e456' as signed);
cast('-123e456' as signed)
-123
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '-123e456'
select coercibility(binary('a'));
coercibility(binary('a'))
2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,16 +817,16 @@ a A
select /*+ inl_hash_join(t2) */ t1.b, t2.b from t1 join t2 where t1.b=t2.b;
b b
a A
show warnings;
Level Code Message
Warning 1815 Optimizer Hint /*+ INL_HASH_JOIN(t2) */ is inapplicable
select /*+ inl_merge_join(t1) */ t1.b, t2.b from t1 join t2 where t1.b=t2.b;
b b
a A
select /*+ inl_merge_join(t2) */ t1.b, t2.b from t1 join t2 where t1.b=t2.b;
b b
a A
show warnings;
Level Code Message
Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t2) */ is inapplicable
drop table if exists a, b;
create table a(i int, k varbinary(40), v int, primary key(i, k) clustered);
create table b(i int, k varchar(40), v int, primary key(i, k) clustered);
Expand Down
47 changes: 26 additions & 21 deletions tests/integrationtest/r/expression/issues.result
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ t CREATE TABLE `t` (
drop table if exists t;
create table t(a tinyint, b bit(63));
insert ignore into t values(599999999, -1);
show warnings;
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Warning 1406 Data too long for column 'b' at row 1
select * from t;
a b
127 �������
drop table if exists t;
create table t(b bit(16));
insert ignore into t values(0x3635313836),(0x333830);
show warnings;
Level Code Message
Warning 1406 Data too long for column 'b' at row 1
Warning 1406 Data too long for column 'b' at row 2
select * from t;
b
��
Expand Down Expand Up @@ -93,8 +95,8 @@ drop table if exists t;
create table t (id int NOT NULL DEFAULT 8);
SET sql_mode = '';
insert into t values (1), (NULL), (2);
show warnings;
Level Code Message
Warning 1048 Column 'id' cannot be null
select * from t;
id
1
Expand Down Expand Up @@ -203,8 +205,8 @@ insert into ft values(1234567890,123467890.1234,123467890.1234,'123467890.123400
SELECT FROM_UNIXTIME(tchar) from ft;
FROM_UNIXTIME(tchar)
1973-11-30 08:38:10.123400
show warnings;
Level Code Message
Warning 1292 Truncated incorrect DECIMAL value: '123467890.1234000000000000000000100111111111'
truncate table ft;
insert into ft values(1234567890,123467890.1234,123467890.1234,'11111123467890.1234');
SELECT FROM_UNIXTIME(tchar) from ft;
Expand Down Expand Up @@ -278,36 +280,36 @@ min max
drop table if exists t_tiny, t_small, t_medium, t_int, t_big;
create table t_tiny (c0 TINYINT UNSIGNED);
INSERT IGNORE INTO t_tiny(c0) VALUES (1E9);
show warnings;
Level Code Message
Warning 1264 Out of range value for column 'c0' at row 1
select * from t_tiny;
c0
255
create table t_small (c0 SMALLINT UNSIGNED);
INSERT IGNORE INTO t_small(c0) VALUES (1E9);
show warnings;
Level Code Message
Warning 1264 Out of range value for column 'c0' at row 1
select * from t_small;
c0
65535
create table t_medium (c0 MEDIUMINT UNSIGNED);
INSERT IGNORE INTO t_medium(c0) VALUES (1E9);
show warnings;
Level Code Message
Warning 1264 Out of range value for column 'c0' at row 1
select * from t_medium;
c0
16777215
create table t_int (c0 INT UNSIGNED);
INSERT IGNORE INTO t_int(c0) VALUES (1E20);
show warnings;
Level Code Message
Warning 1264 Out of range value for column 'c0' at row 1
select * from t_int;
c0
4294967295
create table t_big (c0 BIGINT UNSIGNED);
INSERT IGNORE INTO t_big(c0) VALUES (1E20);
show warnings;
Level Code Message
Warning 1264 Out of range value for column 'c0' at row 1
select * from t_big;
c0
18446744073709551615
Expand Down Expand Up @@ -1357,8 +1359,8 @@ insert into t12205 values('-1038024704','-527892480');
select SEC_TO_TIME( ( `col_varchar_64` & `col_varchar_64_key` ) ),`col_varchar_64` & `col_varchar_64_key` from t12205;
SEC_TO_TIME( ( `col_varchar_64` & `col_varchar_64_key` ) ) `col_varchar_64` & `col_varchar_64_key`
838:59:59 18446744072635875328
show warnings;
Level Code Message
Warning 1292 Truncated incorrect time value: '18446744072635875000'
drop table if exists t;
create table t(1e int);
insert into t values (1);
Expand Down Expand Up @@ -1400,8 +1402,8 @@ insert into t12206 values(73,0,0000);
SELECT TIME_FORMAT( `col_tinyint_unsigned`, ( IFNULL( `col_double_unsigned`, `col_year_key` ) ) ) AS field1 FROM `t12206`;
field1
NULL
show warnings;
Level Code Message
Warning 1292 Truncated incorrect time value: '73'
drop table if exists t12209;
create table t12209(a bigint(20));
insert into t12209 values(1);
Expand Down Expand Up @@ -1743,8 +1745,8 @@ a
a
b
INSERT IGNORE INTO t1 VALUES (REPEAT(0125,200000000));
show warnings;
Level Code Message
Warning 1301 Result of repeat() was larger than max_allowed_packet (67108864) - truncated
select a from t1 order by a;
a
NULL
Expand Down Expand Up @@ -1959,11 +1961,10 @@ create table t (c int primary key, c2 enum('a', 'b'));
set session sql_mode = '';
insert into t values(4, 'a');
insert into t values(4, 0) on duplicate key update c=values(c), c2=values(c2);
show warnings;
Level Code Message
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
insert into t values(4, 'a') on duplicate key update c=values(c), c2=values(c2);
show warnings;
Level Code Message
set @@sql_mode=default;
drop table if exists t0, t1;
CREATE TABLE t0(c0 BOOL, c1 INT);
Expand Down Expand Up @@ -2242,23 +2243,21 @@ coercibility(lag(b, 1, 'B') over w)
SELECT 'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0;
'lvuleck' BETWEEN '2008-09-16 22:23:50' AND 0
0
show warnings;
Level Code Message
Warning 1292 Truncated incorrect DOUBLE value: '2008-09-16 22:23:50'
Warning 1292 Truncated incorrect DOUBLE value: 'lvuleck'
SELECT 'aa' BETWEEN 'bb' AND 0;
'aa' BETWEEN 'bb' AND 0
1
show warnings;
Level Code Message
Warning 1292 Truncated incorrect DOUBLE value: 'aa'
Warning 1292 Truncated incorrect DOUBLE value: 'bb'
select 1 between 0 and b'110';
1 between 0 and b'110'
1
show warnings;
Level Code Message
select 'b' between 'a' and b'110';
'b' between 'a' and b'110'
0
show warnings;
Level Code Message
drop table if exists t;
create table t(a set('a', 'b', 'c'));
alter table t change a a set('a', 'b', 'c', 'c');
Expand Down Expand Up @@ -2686,9 +2685,15 @@ insert into t values('1e649'),('-1e649');
SELECT * FROM t where c < 1;
c
-1e649
Level Code Message
Warning 1292 Truncated incorrect DOUBLE value: '-1e649'
Warning 1292 Truncated incorrect DOUBLE value: '1e649'
SELECT * FROM t where c > 1;
c
1e649
Level Code Message
Warning 1292 Truncated incorrect DOUBLE value: '-1e649'
Warning 1292 Truncated incorrect DOUBLE value: '1e649'
drop table if exists t;
create table t(a int);
insert t values (1);
Expand Down
6 changes: 3 additions & 3 deletions tests/integrationtest/r/expression/json.result
Original file line number Diff line number Diff line change
Expand Up @@ -513,18 +513,18 @@ Error 3144: Cannot create a JSON value from a string with CHARACTER SET 'binary'
select cast(cast(b'010101' as json) as signed);
cast(cast(b'010101' as json) as signed)
0
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '"base64:type253:FQ=="'
select cast(json_extract(json_objectagg('a', b'010101'), '$.a') as signed);
cast(json_extract(json_objectagg('a', b'010101'), '$.a') as signed)
0
show warnings;
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '"base64:type253:FQ=="'
select cast(json_extract(json_objectagg('a', b'010101'), '$.a') as double);
cast(json_extract(json_objectagg('a', b'010101'), '$.a') as double)
0
show warnings;
Level Code Message
Warning 1292 Truncated incorrect FLOAT value: '"base64:type253:FQ=="'
drop table if exists t;
create table t(a JSON);
insert into t values ('{}'), ('true'), ('5');
Expand Down
6 changes: 3 additions & 3 deletions tests/integrationtest/r/expression/misc.result
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Error 1292: Incorrect time value: '20171231235959.999999'
select ADDDATE('2008-01-34', -1);
ADDDATE('2008-01-34', -1)
NULL
Show warnings;
Level Code Message
Warning 1292 Incorrect datetime value: '2008-01-34'
set sql_mode='';
drop table if exists t;
create table t1(a decimal(10,5), b decimal(10,1));
Expand Down Expand Up @@ -237,12 +237,12 @@ create table t(a int);
select /*+ unknown_hint(c1)*/ 1;
1
1
show warnings;
Level Code Message
Warning 1064 Optimizer hint syntax error at line 1 column 23 near "unknown_hint(c1)*/"
select 1 from /*+ test1() */ t;
1
show warnings;
Level Code Message
Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use [parser:8066]Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.
drop table if exists t;
create table t(a bigint, b double, c decimal, d varchar(20), e datetime, f time, g json);
insert into t values(1, 1.1, 2.2, "abc", "2018-10-24", NOW(), "12");
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/r/expression/time.result
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ timestampadd(minute, 1.5, '2021-08-20 00:00:00.0001')
SELECT timestampadd(year,1.212208e+308,'1995-01-05 06:32:20.859724') as result;
result
NULL
show warnings;
Level Code Message
Warning 1441 Datetime function: datetime field overflow
select DATE_ADD('2007-03-28 22:08:28',INTERVAL -2 SECOND_MICROSECOND);
DATE_ADD('2007-03-28 22:08:28',INTERVAL -2 SECOND_MICROSECOND)
2007-03-28 22:08:27.800000
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function build_mysql_tester()
{
echo "building mysql-tester binary: $mysql_tester"
rm -rf $mysql_tester
GOBIN=$PWD go install github.com/defined2014/mysql-tester/src@1da6225968e19999d28be4d06c357b9378df8b78
GOBIN=$PWD go install github.com/pingcap/mysql-tester/src@6891b636aa6ba666e426238f9c74deb502b846d2
mv src mysql_tester
}

Expand Down
4 changes: 0 additions & 4 deletions tests/integrationtest/t/common_collation.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
set tidb_cost_model_version=1;
--disable_warnings
drop table if exists t;
--enable_warnings
create table t(a char(10) collate utf8mb4_unicode_ci, b char(10) collate utf8mb4_general_ci);
insert into t values ('啊', '撒旦');
select coercibility(concat(a, b)) from t;
Expand All @@ -11,9 +9,7 @@ select coercibility(convert('a' using utf8mb4) collate utf8mb4_general_ci);

# test for coercibility and collation with json type
# see details from https://github.com/pingcap/tidb/issues/31541 and https://github.com/pingcap/tidb/issues/31320#issuecomment-1010599311
--disable_warnings
drop table if exists t;
--enable_warnings
create table t (a char(20), b blob(100), c text, d json, e timestamp, f set('a一','b二','c三','d四'), g text, h enum('a一','b二','c三','d四') default 'c三');
insert into t values ('你好', '你好', '你好', '{\"测试\": \"你好\"}', '2018-10-13', 1, '你好', 'a一');
select coercibility(a), coercibility(b), coercibility(c), coercibility(d), coercibility(e), coercibility(f), coercibility(g), coercibility(h) from t;
Expand Down
Loading

0 comments on commit 7d71771

Please sign in to comment.