From 2bf12bd95446d343292652e5a0685859b5fa1718 Mon Sep 17 00:00:00 2001 From: lysu Date: Thu, 26 Mar 2020 19:25:38 +0800 Subject: [PATCH] cherry pick #15512 to release-3.0 Signed-off-by: sre-bot --- executor/executor_test.go | 15 +++++++++++++++ util/chunk/codec.go | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/executor/executor_test.go b/executor/executor_test.go index 30ec980bab880..6b176c93a538e 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -3338,7 +3338,22 @@ func (s *testSuite3) TestIndexJoinTableDualPanic(c *C) { Check(testkit.Rows("1 a")) } +<<<<<<< HEAD func (s *testSuite3) TestUnionAutoSignedCast(c *C) { +======= +func (s *testSuite3) TestSortLeftJoinWithNullColumnInRightChildPanic(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t1, t2") + tk.MustExec("create table t1(a int)") + tk.MustExec("create table t2(a int)") + tk.MustExec("insert into t1(a) select 1;") + tk.MustQuery("select b.n from t1 left join (select a as a, null as n from t2) b on b.a = t1.a order by t1.a"). + Check(testkit.Rows("")) +} + +func (s *testSuiteP1) TestUnionAutoSignedCast(c *C) { +>>>>>>> 01db67b... chunk: make `mysql.TypeNull` be judged as fixedLen (#15512) tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t1,t2") diff --git a/util/chunk/codec.go b/util/chunk/codec.go index 4458dbe76e1bc..498e034000269 100644 --- a/util/chunk/codec.go +++ b/util/chunk/codec.go @@ -171,7 +171,7 @@ func getFixedLen(colType *types.FieldType) int { case mysql.TypeFloat: return 4 case mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, - mysql.TypeLonglong, mysql.TypeDouble, mysql.TypeYear, mysql.TypeDuration: + mysql.TypeLonglong, mysql.TypeDouble, mysql.TypeYear, mysql.TypeDuration, mysql.TypeNull: return 8 case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeTimestamp: return 16