From 785daa66b4e7a0f4061055b6f5f1a818f4c8fbc3 Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Tue, 28 May 2024 13:43:20 +0800 Subject: [PATCH 1/2] This is an automated cherry-pick of #53590 Signed-off-by: ti-chi-bot --- expression/builtin_compare.go | 7 + .../integrationtest/r/expression/cast.result | 150 ++++++++++++++++++ tests/integrationtest/t/expression/cast.test | 89 +++++++++++ 3 files changed, 246 insertions(+) create mode 100644 tests/integrationtest/r/expression/cast.result create mode 100644 tests/integrationtest/t/expression/cast.test diff --git a/expression/builtin_compare.go b/expression/builtin_compare.go index 4b2a220db33bb..ddf9d7322f9ed 100644 --- a/expression/builtin_compare.go +++ b/expression/builtin_compare.go @@ -1481,7 +1481,14 @@ func RefineComparedConstant(ctx sessionctx.Context, targetFieldType types.FieldT targetFieldType = *types.NewFieldType(mysql.TypeLonglong) } var intDatum types.Datum +<<<<<<< HEAD:expression/builtin_compare.go intDatum, err = dt.ConvertTo(sc, &targetFieldType) +======= + // Disable AllowNegativeToUnsigned to make sure return 0 when underflow happens. + oriTypeCtx := evalCtx.TypeCtx() + newTypeCtx := oriTypeCtx.WithFlags(oriTypeCtx.Flags().WithAllowNegativeToUnsigned(false)) + intDatum, err = dt.ConvertTo(newTypeCtx, &targetFieldType) +>>>>>>> 68d12954fe4 (expression: fix wrong result when convert float to unsigned (#53590)):pkg/expression/builtin_compare.go if err != nil { if terror.ErrorEqual(err, types.ErrOverflow) { return &Constant{ diff --git a/tests/integrationtest/r/expression/cast.result b/tests/integrationtest/r/expression/cast.result new file mode 100644 index 0000000000000..76c9977dc52fb --- /dev/null +++ b/tests/integrationtest/r/expression/cast.result @@ -0,0 +1,150 @@ +select cast('' as signed); +cast('' as signed) +0 +Level Code Message +Warning 1292 Truncated incorrect INTEGER value: '' +select cast('12345abcde' as signed); +cast('12345abcde' as signed) +12345 +Level Code Message +Warning 1292 Truncated incorrect INTEGER value: '12345abcde' +select cast('123e456' as signed); +cast('123e456' as signed) +123 +Level Code Message +Warning 1292 Truncated incorrect INTEGER value: '123e456' +select cast('-12345abcde' as signed); +cast('-12345abcde' as signed) +-12345 +Level Code Message +Warning 1292 Truncated incorrect INTEGER value: '-12345abcde' +select cast('-123e456' as signed); +cast('-123e456' as signed) +-123 +Level Code Message +Warning 1292 Truncated incorrect INTEGER value: '-123e456' +select coercibility(binary('a')); +coercibility(binary('a')) +2 +select coercibility(cast('a' as char(10))); +coercibility(cast('a' as char(10))) +2 +select coercibility(convert('abc', char(10))); +coercibility(convert('abc', char(10))) +2 +drop table if exists t; +create table t(d1 double, f float, d2 decimal(24,8)); +insert into t values(0, 0, 0); +select cast(111.1 as datetime) from t; +cast(111.1 as datetime) +2000-01-11 00:00:00 +select cast(1311.1 as datetime) from t; +cast(1311.1 as datetime) +NULL +insert into t values(111.1, 1122.1, 31212.111); +insert into t values(121212.1111, 1121212.111111, 11121212.111111); +insert into t values(99991111.1111111, 101.1111111, 20121212121212.1111111); +insert into t values(NULL, NULL, NULL); +insert into t values(1.1, 48.1, 100.1); +insert into t values(1301.11, 1131.111, 100001111.111); +insert into t values(20121212121260.1111111, 20121212126012.1111111, 20121212241212.1111111); +select cast(d1 as datetime), cast(f as datetime), cast(d2 as datetime) from t; +cast(d1 as datetime) cast(f as datetime) cast(d2 as datetime) +NULL NULL NULL +NULL NULL NULL +NULL NULL NULL +NULL NULL NULL +0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 +2000-01-11 00:00:00 2000-11-22 00:00:00 2003-12-12 00:00:00 +2012-12-12 00:00:00 0112-12-12 00:00:00 1112-12-12 00:00:00 +9999-11-11 00:00:00 2000-01-01 00:00:00 2012-12-12 12:12:12 +drop table if exists t; +create table t (col1 bigint, col2 double, col3 decimal, col4 varchar(20), col5 json); +insert into t values (1, 1, 1, "1", "1"); +insert into t values (null, null, null, null, null); +select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 = 1; +cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time) +00:00:01 00:00:01 00:00:01 00:00:01 NULL +select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 is null; +cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time) +NULL NULL NULL NULL NULL +select cast(col1 as time(31)) from t where col1 is null; +Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +select cast(col2 as time(31)) from t where col1 is null; +Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +select cast(col3 as time(31)) from t where col1 is null; +Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +select cast(col4 as time(31)) from t where col1 is null; +Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +select cast(col5 as time(31)) from t where col1 is null; +Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. +drop table if exists t; +create table t(a varchar(50)); +insert into t values ('2020-01-01 12:00:00.123456 +0600 PST'); +insert into t values ('2020-01-01 12:00:00.123456 -0600 PST'); +insert into t values ('2020-01-01 12:00:00.123456'); +select cast(a as datetime(3)) from t; +cast(a as datetime(3)) +2020-01-01 12:00:00.123 +2020-01-01 12:00:00.123 +2020-01-01 12:00:00.123 +drop table if exists t1; +create table t1 (c1 text); +insert into t1 values ('a'); +update t1 set c1 = cast('61qw' as decimal); +Error 1292 (22007): Truncated incorrect DECIMAL value: '61qw' +select cast('61qw' as decimal); +cast('61qw' as decimal) +61 +Level Code Message +Warning 1292 Truncated incorrect DECIMAL value: '61qw' +drop table if exists t; +create table t (y year); +insert into t values (cast('14:15' as time)); +select 1 from t where y = YEAR(CURDATE()); +1 +1 +select cast(cast('14:15' as time) as year) = YEAR(CURDATE()); +cast(cast('14:15' as time) as year) = YEAR(CURDATE()) +1 +explain select null as a union all select 'a' as a; +id estRows task access object operator info +Union_8 2.00 root +├─Projection_10 1.00 root ->Column#3 +│ └─TableDual_11 1.00 root rows:1 +└─Projection_12 1.00 root a->Column#3 + └─TableDual_13 1.00 root rows:1 +select null as a union all select 'a' as a; +a +NULL +a +drop table if exists t0; +create table t0(c0 tinyint(1) unsigned not null ); +insert into t0 values (1); +select * from t0 where case 0 when t0.c0 > -1.194192591e9 then null else 1 end; +c0 +1 +select t0.c0 > -1.194192591e9 from t0; +t0.c0 > -1.194192591e9 +1 +select t0.c0 < -1.194192591e9 from t0; +t0.c0 < -1.194192591e9 +0 +select -1.194192591e9 > t0.c0 from t0; +-1.194192591e9 > t0.c0 +0 +select -1.194192591e9 < t0.c0 from t0; +-1.194192591e9 < t0.c0 +1 +select t0.c0 > 1.194192591e9 from t0; +t0.c0 > 1.194192591e9 +0 +select t0.c0 < 1.194192591e9 from t0; +t0.c0 < 1.194192591e9 +1 +select 1.194192591e9 > t0.c0 from t0; +1.194192591e9 > t0.c0 +1 +select 1.194192591e9 < t0.c0 from t0; +1.194192591e9 < t0.c0 +0 diff --git a/tests/integrationtest/t/expression/cast.test b/tests/integrationtest/t/expression/cast.test new file mode 100644 index 0000000000000..03843628ab9e6 --- /dev/null +++ b/tests/integrationtest/t/expression/cast.test @@ -0,0 +1,89 @@ +# TestCastStrToInt +--enable_warnings +select cast('' as signed); +select cast('12345abcde' as signed); +select cast('123e456' as signed); +select cast('-12345abcde' as signed); +select cast('-123e456' as signed); +--disable_warnings + +# TestCastCoer +select coercibility(binary('a')); +select coercibility(cast('a' as char(10))); +select coercibility(convert('abc', char(10))); + +# TestCastRealAsTime +drop table if exists t; +create table t(d1 double, f float, d2 decimal(24,8)); +insert into t values(0, 0, 0); +select cast(111.1 as datetime) from t; +select cast(1311.1 as datetime) from t; +insert into t values(111.1, 1122.1, 31212.111); +insert into t values(121212.1111, 1121212.111111, 11121212.111111); +insert into t values(99991111.1111111, 101.1111111, 20121212121212.1111111); +insert into t values(NULL, NULL, NULL); +insert into t values(1.1, 48.1, 100.1); +insert into t values(1301.11, 1131.111, 100001111.111); +insert into t values(20121212121260.1111111, 20121212126012.1111111, 20121212241212.1111111); +-- sorted_result +select cast(d1 as datetime), cast(f as datetime), cast(d2 as datetime) from t; + +# TestCastAsTime +drop table if exists t; +create table t (col1 bigint, col2 double, col3 decimal, col4 varchar(20), col5 json); +insert into t values (1, 1, 1, "1", "1"); +insert into t values (null, null, null, null, null); +select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 = 1; +select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 is null; +-- error 1426 +select cast(col1 as time(31)) from t where col1 is null; +-- error 1426 +select cast(col2 as time(31)) from t where col1 is null; +-- error 1426 +select cast(col3 as time(31)) from t where col1 is null; +-- error 1426 +select cast(col4 as time(31)) from t where col1 is null; +-- error 1426 +select cast(col5 as time(31)) from t where col1 is null; +drop table if exists t; +create table t(a varchar(50)); +insert into t values ('2020-01-01 12:00:00.123456 +0600 PST'); +insert into t values ('2020-01-01 12:00:00.123456 -0600 PST'); +insert into t values ('2020-01-01 12:00:00.123456'); +select cast(a as datetime(3)) from t; + +# TestCastErrMsg +drop table if exists t1; +create table t1 (c1 text); +insert into t1 values ('a'); +--error 1292 +update t1 set c1 = cast('61qw' as decimal); +--enable_warnings +select cast('61qw' as decimal); +--disable_warnings + +# TestCastTimeAsYear +drop table if exists t; +create table t (y year); +insert into t values (cast('14:15' as time)); +select 1 from t where y = YEAR(CURDATE()); +select cast(cast('14:15' as time) as year) = YEAR(CURDATE()); + +# TestIssue49526 +explain select null as a union all select 'a' as a; +--sorted_result +select null as a union all select 'a' as a; + +# TestNegFloatConvertToUnsigned +drop table if exists t0; +create table t0(c0 tinyint(1) unsigned not null ); +insert into t0 values (1); +select * from t0 where case 0 when t0.c0 > -1.194192591e9 then null else 1 end; +select t0.c0 > -1.194192591e9 from t0; +select t0.c0 < -1.194192591e9 from t0; +select -1.194192591e9 > t0.c0 from t0; +select -1.194192591e9 < t0.c0 from t0; +select t0.c0 > 1.194192591e9 from t0; +select t0.c0 < 1.194192591e9 from t0; +select 1.194192591e9 > t0.c0 from t0; +select 1.194192591e9 < t0.c0 from t0; From d285334af604f75d1b5f231f565fd53a3b987c57 Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Tue, 28 May 2024 17:27:33 +0800 Subject: [PATCH 2/2] fix conflict Signed-off-by: guo-shaoge --- expression/builtin_compare.go | 13 +- sessionctx/stmtctx/stmtctx.go | 5 +- .../integrationtest/r/expression/cast.result | 120 ------------------ tests/integrationtest/t/expression/cast.test | 76 ----------- 4 files changed, 10 insertions(+), 204 deletions(-) diff --git a/expression/builtin_compare.go b/expression/builtin_compare.go index ddf9d7322f9ed..b46db7522f2fe 100644 --- a/expression/builtin_compare.go +++ b/expression/builtin_compare.go @@ -1481,14 +1481,13 @@ func RefineComparedConstant(ctx sessionctx.Context, targetFieldType types.FieldT targetFieldType = *types.NewFieldType(mysql.TypeLonglong) } var intDatum types.Datum -<<<<<<< HEAD:expression/builtin_compare.go + // To make sure return zero when underflow happens. + oriFlag := sc.IsRefineComparedConstant + sc.IsRefineComparedConstant = true + defer func() { + sc.IsRefineComparedConstant = oriFlag + }() intDatum, err = dt.ConvertTo(sc, &targetFieldType) -======= - // Disable AllowNegativeToUnsigned to make sure return 0 when underflow happens. - oriTypeCtx := evalCtx.TypeCtx() - newTypeCtx := oriTypeCtx.WithFlags(oriTypeCtx.Flags().WithAllowNegativeToUnsigned(false)) - intDatum, err = dt.ConvertTo(newTypeCtx, &targetFieldType) ->>>>>>> 68d12954fe4 (expression: fix wrong result when convert float to unsigned (#53590)):pkg/expression/builtin_compare.go if err != nil { if terror.ErrorEqual(err, types.ErrOverflow) { return &Constant{ diff --git a/sessionctx/stmtctx/stmtctx.go b/sessionctx/stmtctx/stmtctx.go index d5f19e8fe6dd5..981c6984ab20a 100644 --- a/sessionctx/stmtctx/stmtctx.go +++ b/sessionctx/stmtctx/stmtctx.go @@ -132,6 +132,9 @@ type StatementContext struct { SkipUTF8Check bool SkipASCIICheck bool SkipUTF8MB4Check bool + + IsRefineComparedConstant bool + // If the select statement was like 'select * from t as of timestamp ...' or in a stale read transaction // or is affected by the tidb_read_staleness session variable, then the statement will be makred as isStaleness // in stmtCtx @@ -775,7 +778,7 @@ func (sc *StatementContext) GetExecDetails() execdetails.ExecDetails { // This is the case for `insert`, `update`, `alter table`, `create table` and `load data infile` statements, when not in strict SQL mode. // see https://dev.mysql.com/doc/refman/5.7/en/out-of-range-and-overflow.html func (sc *StatementContext) ShouldClipToZero() bool { - return sc.InInsertStmt || sc.InLoadDataStmt || sc.InUpdateStmt || sc.InCreateOrAlterStmt || sc.IsDDLJobInQueue + return sc.InInsertStmt || sc.InLoadDataStmt || sc.InUpdateStmt || sc.InCreateOrAlterStmt || sc.IsDDLJobInQueue || sc.IsRefineComparedConstant } // ShouldIgnoreOverflowError indicates whether we should ignore the error when type conversion overflows, diff --git a/tests/integrationtest/r/expression/cast.result b/tests/integrationtest/r/expression/cast.result index 76c9977dc52fb..c7938cb727e72 100644 --- a/tests/integrationtest/r/expression/cast.result +++ b/tests/integrationtest/r/expression/cast.result @@ -1,123 +1,3 @@ -select cast('' as signed); -cast('' as signed) -0 -Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '' -select cast('12345abcde' as signed); -cast('12345abcde' as signed) -12345 -Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '12345abcde' -select cast('123e456' as signed); -cast('123e456' as signed) -123 -Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '123e456' -select cast('-12345abcde' as signed); -cast('-12345abcde' as signed) --12345 -Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '-12345abcde' -select cast('-123e456' as signed); -cast('-123e456' as signed) --123 -Level Code Message -Warning 1292 Truncated incorrect INTEGER value: '-123e456' -select coercibility(binary('a')); -coercibility(binary('a')) -2 -select coercibility(cast('a' as char(10))); -coercibility(cast('a' as char(10))) -2 -select coercibility(convert('abc', char(10))); -coercibility(convert('abc', char(10))) -2 -drop table if exists t; -create table t(d1 double, f float, d2 decimal(24,8)); -insert into t values(0, 0, 0); -select cast(111.1 as datetime) from t; -cast(111.1 as datetime) -2000-01-11 00:00:00 -select cast(1311.1 as datetime) from t; -cast(1311.1 as datetime) -NULL -insert into t values(111.1, 1122.1, 31212.111); -insert into t values(121212.1111, 1121212.111111, 11121212.111111); -insert into t values(99991111.1111111, 101.1111111, 20121212121212.1111111); -insert into t values(NULL, NULL, NULL); -insert into t values(1.1, 48.1, 100.1); -insert into t values(1301.11, 1131.111, 100001111.111); -insert into t values(20121212121260.1111111, 20121212126012.1111111, 20121212241212.1111111); -select cast(d1 as datetime), cast(f as datetime), cast(d2 as datetime) from t; -cast(d1 as datetime) cast(f as datetime) cast(d2 as datetime) -NULL NULL NULL -NULL NULL NULL -NULL NULL NULL -NULL NULL NULL -0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 -2000-01-11 00:00:00 2000-11-22 00:00:00 2003-12-12 00:00:00 -2012-12-12 00:00:00 0112-12-12 00:00:00 1112-12-12 00:00:00 -9999-11-11 00:00:00 2000-01-01 00:00:00 2012-12-12 12:12:12 -drop table if exists t; -create table t (col1 bigint, col2 double, col3 decimal, col4 varchar(20), col5 json); -insert into t values (1, 1, 1, "1", "1"); -insert into t values (null, null, null, null, null); -select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 = 1; -cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time) -00:00:01 00:00:01 00:00:01 00:00:01 NULL -select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 is null; -cast(col1 as time) cast(col2 as time) cast(col3 as time) cast(col4 as time) cast(col5 as time) -NULL NULL NULL NULL NULL -select cast(col1 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. -select cast(col2 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. -select cast(col3 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. -select cast(col4 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. -select cast(col5 as time(31)) from t where col1 is null; -Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6. -drop table if exists t; -create table t(a varchar(50)); -insert into t values ('2020-01-01 12:00:00.123456 +0600 PST'); -insert into t values ('2020-01-01 12:00:00.123456 -0600 PST'); -insert into t values ('2020-01-01 12:00:00.123456'); -select cast(a as datetime(3)) from t; -cast(a as datetime(3)) -2020-01-01 12:00:00.123 -2020-01-01 12:00:00.123 -2020-01-01 12:00:00.123 -drop table if exists t1; -create table t1 (c1 text); -insert into t1 values ('a'); -update t1 set c1 = cast('61qw' as decimal); -Error 1292 (22007): Truncated incorrect DECIMAL value: '61qw' -select cast('61qw' as decimal); -cast('61qw' as decimal) -61 -Level Code Message -Warning 1292 Truncated incorrect DECIMAL value: '61qw' -drop table if exists t; -create table t (y year); -insert into t values (cast('14:15' as time)); -select 1 from t where y = YEAR(CURDATE()); -1 -1 -select cast(cast('14:15' as time) as year) = YEAR(CURDATE()); -cast(cast('14:15' as time) as year) = YEAR(CURDATE()) -1 -explain select null as a union all select 'a' as a; -id estRows task access object operator info -Union_8 2.00 root -├─Projection_10 1.00 root ->Column#3 -│ └─TableDual_11 1.00 root rows:1 -└─Projection_12 1.00 root a->Column#3 - └─TableDual_13 1.00 root rows:1 -select null as a union all select 'a' as a; -a -NULL -a drop table if exists t0; create table t0(c0 tinyint(1) unsigned not null ); insert into t0 values (1); diff --git a/tests/integrationtest/t/expression/cast.test b/tests/integrationtest/t/expression/cast.test index 03843628ab9e6..6876072d60365 100644 --- a/tests/integrationtest/t/expression/cast.test +++ b/tests/integrationtest/t/expression/cast.test @@ -1,79 +1,3 @@ -# TestCastStrToInt ---enable_warnings -select cast('' as signed); -select cast('12345abcde' as signed); -select cast('123e456' as signed); -select cast('-12345abcde' as signed); -select cast('-123e456' as signed); ---disable_warnings - -# TestCastCoer -select coercibility(binary('a')); -select coercibility(cast('a' as char(10))); -select coercibility(convert('abc', char(10))); - -# TestCastRealAsTime -drop table if exists t; -create table t(d1 double, f float, d2 decimal(24,8)); -insert into t values(0, 0, 0); -select cast(111.1 as datetime) from t; -select cast(1311.1 as datetime) from t; -insert into t values(111.1, 1122.1, 31212.111); -insert into t values(121212.1111, 1121212.111111, 11121212.111111); -insert into t values(99991111.1111111, 101.1111111, 20121212121212.1111111); -insert into t values(NULL, NULL, NULL); -insert into t values(1.1, 48.1, 100.1); -insert into t values(1301.11, 1131.111, 100001111.111); -insert into t values(20121212121260.1111111, 20121212126012.1111111, 20121212241212.1111111); --- sorted_result -select cast(d1 as datetime), cast(f as datetime), cast(d2 as datetime) from t; - -# TestCastAsTime -drop table if exists t; -create table t (col1 bigint, col2 double, col3 decimal, col4 varchar(20), col5 json); -insert into t values (1, 1, 1, "1", "1"); -insert into t values (null, null, null, null, null); -select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 = 1; -select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 is null; --- error 1426 -select cast(col1 as time(31)) from t where col1 is null; --- error 1426 -select cast(col2 as time(31)) from t where col1 is null; --- error 1426 -select cast(col3 as time(31)) from t where col1 is null; --- error 1426 -select cast(col4 as time(31)) from t where col1 is null; --- error 1426 -select cast(col5 as time(31)) from t where col1 is null; -drop table if exists t; -create table t(a varchar(50)); -insert into t values ('2020-01-01 12:00:00.123456 +0600 PST'); -insert into t values ('2020-01-01 12:00:00.123456 -0600 PST'); -insert into t values ('2020-01-01 12:00:00.123456'); -select cast(a as datetime(3)) from t; - -# TestCastErrMsg -drop table if exists t1; -create table t1 (c1 text); -insert into t1 values ('a'); ---error 1292 -update t1 set c1 = cast('61qw' as decimal); ---enable_warnings -select cast('61qw' as decimal); ---disable_warnings - -# TestCastTimeAsYear -drop table if exists t; -create table t (y year); -insert into t values (cast('14:15' as time)); -select 1 from t where y = YEAR(CURDATE()); -select cast(cast('14:15' as time) as year) = YEAR(CURDATE()); - -# TestIssue49526 -explain select null as a union all select 'a' as a; ---sorted_result -select null as a union all select 'a' as a; - # TestNegFloatConvertToUnsigned drop table if exists t0; create table t0(c0 tinyint(1) unsigned not null );