From f116b4e80960b0b346765a642cb745c5eb334304 Mon Sep 17 00:00:00 2001 From: wshwsh12 <793703860@qq.com> Date: Thu, 7 Sep 2023 14:47:13 +0800 Subject: [PATCH] resolve conflict --- expression/integration_test.go | 37 +++------------------------------- types/datum.go | 7 ------- 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/expression/integration_test.go b/expression/integration_test.go index 9a0da21f60192..edac77c7630cf 100644 --- a/expression/integration_test.go +++ b/expression/integration_test.go @@ -7069,41 +7069,11 @@ func TestIfFunctionWithNull(t *testing.T) { tk.MustQuery("select min(if(apply_to_now_days <= 30,loan,null)) as min, max(if(apply_to_now_days <= 720,loan,null)) as max from (select loan, datediff(from_unixtime(unix_timestamp('2023-05-18 18:43:43') + 18000), from_unixtime(apply_time/1000 + 18000)) as apply_to_now_days from orders) t1;").Sort().Check( testkit.Rows("20000 35100")) } -<<<<<<< HEAD:expression/integration_test.go -======= -func TestIssue41733AndIssue45410(t *testing.T) { - store := testkit.CreateMockStore(t) +func TestIssue45410(t *testing.T) { + store, clean := testkit.CreateMockStore(t) + defer clean() tk := testkit.NewTestKit(t, store) - tk.MustExec("create database testIssue41733") - defer tk.MustExec("drop database testIssue41733") - tk.MustExec("use testIssue41733") - - tk.MustExec("create table t_tiny (c0 TINYINT UNSIGNED)") - tk.MustExec("INSERT IGNORE INTO t_tiny(c0) VALUES (1E9)") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1264 Out of range value for column 'c0' at row 1")) - tk.MustQuery("select * from t_tiny;").Check(testkit.Rows("255")) - - tk.MustExec("create table t_small (c0 SMALLINT UNSIGNED)") - tk.MustExec("INSERT IGNORE INTO t_small(c0) VALUES (1E9)") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1264 Out of range value for column 'c0' at row 1")) - tk.MustQuery("select * from t_small;").Check(testkit.Rows("65535")) - - tk.MustExec("create table t_medium (c0 MEDIUMINT UNSIGNED)") - tk.MustExec("INSERT IGNORE INTO t_medium(c0) VALUES (1E9)") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1264 Out of range value for column 'c0' at row 1")) - tk.MustQuery("select * from t_medium;").Check(testkit.Rows("16777215")) - - tk.MustExec("create table t_int (c0 INT UNSIGNED)") - tk.MustExec("INSERT IGNORE INTO t_int(c0) VALUES (1E20)") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1264 Out of range value for column 'c0' at row 1")) - tk.MustQuery("select * from t_int;").Check(testkit.Rows("4294967295")) - - tk.MustExec("create table t_big (c0 BIGINT UNSIGNED)") - tk.MustExec("INSERT IGNORE INTO t_big(c0) VALUES (1E20)") - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1264 Out of range value for column 'c0' at row 1")) - tk.MustQuery("select * from t_big;").Check(testkit.Rows("18446744073709551615")) - // Issue 45410 tk.MustExec("create database testIssue45410") defer tk.MustExec("drop database testIssue45410") @@ -7114,4 +7084,3 @@ func TestIssue41733AndIssue45410(t *testing.T) { tk.MustExec("INSERT INTO t1 VALUES (0);") tk.MustQuery("SELECT c1>=CAST('-787360724' AS TIME) FROM t1;").Check(testkit.Rows("1")) } ->>>>>>> ca696229234 (expression: fix wrong result for unsigned non-const int cmp const duration (#46620)):expression/integration_test/integration_test.go diff --git a/types/datum.go b/types/datum.go index d5c87c214eaa7..09cec112e732c 100644 --- a/types/datum.go +++ b/types/datum.go @@ -1159,18 +1159,11 @@ func (d *Datum) convertToUint(sc *stmtctx.StatementContext, target *FieldType) ( } case KindMysqlDuration: dec := d.GetMysqlDuration().ToNumber() -<<<<<<< HEAD err = dec.Round(dec, 0, ModeHalfEven) - ival, err1 := dec.ToInt() - if err1 == nil { - val, err = ConvertIntToUint(sc, ival, upperBound, tp) -======= - err = dec.Round(dec, 0, ModeHalfUp) var err1 error val, err1 = ConvertDecimalToUint(sc, dec, upperBound, tp) if err == nil { err = err1 ->>>>>>> ca696229234 (expression: fix wrong result for unsigned non-const int cmp const duration (#46620)) } case KindMysqlDecimal: val, err = ConvertDecimalToUint(sc, d.GetMysqlDecimal(), upperBound, tp)