Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
wshwsh12 committed Sep 7, 2023
1 parent 16b9ab0 commit f116b4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 41 deletions.
37 changes: 3 additions & 34 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
7 changes: 0 additions & 7 deletions types/datum.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f116b4e

Please sign in to comment.