From 23f9cad7755e570818a093f90197a0f494cf560b Mon Sep 17 00:00:00 2001 From: xuhuaiyu <391585975@qq.com> Date: Wed, 10 Jun 2020 16:59:35 +0800 Subject: [PATCH] planner, util: new unfixed mutrow for TypeNull --- planner/core/integration_test.go | 11 +++++++++++ util/chunk/codec.go | 2 +- util/chunk/mutrow.go | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 82f4c396695d2..ee5e5bcf7cd26 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -1117,3 +1117,14 @@ func (s *testIntegrationSuite) TestHintParserWarnings(c *C) { rows := tk.MustQuery("show warnings;").Rows() c.Assert(len(rows), Equals, 1) } + +func (s *testIntegrationSuite) TestIssue16935(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t0;") + tk.MustExec("CREATE TABLE t0(c0 INT);") + tk.MustExec("INSERT INTO t0(c0) VALUES (1), (1), (1), (1), (1), (1);") + tk.MustExec("CREATE definer='root'@'localhost' VIEW v0(c0) AS SELECT NULL FROM t0;") + + tk.MustQuery("SELECT * FROM t0 LEFT JOIN v0 ON TRUE WHERE v0.c0 IS NULL;") +} diff --git a/util/chunk/codec.go b/util/chunk/codec.go index 9d0636f410119..2858fb89b55a7 100644 --- a/util/chunk/codec.go +++ b/util/chunk/codec.go @@ -173,7 +173,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.TypeNull: + mysql.TypeLonglong, mysql.TypeDouble, mysql.TypeYear, mysql.TypeDuration: return 8 case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeTimestamp: return sizeTime diff --git a/util/chunk/mutrow.go b/util/chunk/mutrow.go index f0f2138cbd6e8..46a9a3a1fe850 100644 --- a/util/chunk/mutrow.go +++ b/util/chunk/mutrow.go @@ -121,7 +121,7 @@ func zeroValForType(tp *types.FieldType) interface{} { func makeMutRowColumn(in interface{}) *Column { switch x := in.(type) { case nil: - col := makeMutRowUint64Column(uint64(0)) + col := makeMutRowBytesColumn(nil) col.nullBitmap[0] = 0 return col case int: