From 10f9542860dc9d8ce948ee1d35367979addf9510 Mon Sep 17 00:00:00 2001 From: xufei Date: Thu, 28 Dec 2023 17:22:58 +0800 Subject: [PATCH] fix invalid memory access bug in `tidbGreatestString` (#8613) close pingcap/tiflash#8604 --- dbms/src/Functions/LeastGreatest.h | 50 ++++------ tests/fullstack-test/mpp/issue_8604.test | 122 +++++++++++++++++++++++ 2 files changed, 140 insertions(+), 32 deletions(-) create mode 100644 tests/fullstack-test/mpp/issue_8604.test diff --git a/dbms/src/Functions/LeastGreatest.h b/dbms/src/Functions/LeastGreatest.h index 01d92b3e2af..a757ec904a4 100644 --- a/dbms/src/Functions/LeastGreatest.h +++ b/dbms/src/Functions/LeastGreatest.h @@ -143,7 +143,6 @@ struct LeastGreatestStringImpl size_t i) { int res = 0; - auto pre_offset = StringUtil::offsetAt(c_offsets, i); if constexpr (use_collator) res = collator->compare( reinterpret_cast(&a_data[0]), @@ -155,50 +154,37 @@ struct LeastGreatestStringImpl {reinterpret_cast(&a_data[0]), a_size}, {reinterpret_cast(&b_data[0]), b_size}); + auto append_data = [&](const unsigned char * data, size_t size) { + auto pre_offset = StringUtil::offsetAt(c_offsets, i); + auto expected_reserved_size = pre_offset + size + 1; + c_data.resize(expected_reserved_size); + memcpy(&c_data[pre_offset], data, size); + c_data[pre_offset + size] = 0; + c_offsets[i] = pre_offset + size + 1; + }; + if constexpr (least) { if (res < 0) { - memcpy(&c_data[pre_offset], &a_data[0], a_size); - c_offsets[i] = pre_offset + a_size + 1; - } - else if (res == 0) - { - size_t size = std::min(a_size, b_size); - memcpy(&c_data[pre_offset], &b_data[0], size); - c_offsets[i] = pre_offset + size + 1; + append_data(a_data, a_size); } else { - memcpy(&c_data[pre_offset], &b_data[0], b_size); - c_offsets[i] = pre_offset + b_size + 1; + assert(res > 0 || a_size == b_size); + append_data(b_data, b_size); } } else { if (res < 0) { - memcpy(&c_data[pre_offset], &b_data[0], b_size); - c_offsets[i] = pre_offset + b_size + 1; - } - else if (res == 0) - { - size_t size = std::max(a_size, b_size); - if (a_size > b_size) - { - memcpy(&c_data[pre_offset], &a_data[0], size); - c_offsets[i] = pre_offset + size + 1; - } - else - { - memcpy(&c_data[pre_offset], &b_data[0], size); - c_offsets[i] = pre_offset + size + 1; - } + append_data(b_data, b_size); } else { - memcpy(&c_data[pre_offset], &a_data[0], a_size); - c_offsets[i] = pre_offset + a_size + 1; + assert(res > 0 || a_size == b_size); + append_data(a_data, a_size); } } } @@ -406,8 +392,8 @@ struct StringOperationImpl size_t size = res_ref.size(); size_t res_ref_size = 0; for (auto & ref : res_ref) - res_ref_size += ref.size; - c_data.resize(std::max(res_ref_size, b.size * size)); + res_ref_size += ref.size + 1; + c_data.reserve(std::max(res_ref_size, (b.size + 1) * size)); c_offsets.resize(size); for (size_t i = 0; i < size; ++i) LeastGreatestStringImpl::process(collator, res_ref, b, c_data, c_offsets, i); @@ -422,7 +408,7 @@ struct StringOperationImpl ColumnString::Offsets & c_offsets) { size_t size = a_offsets.size(); - c_data.resize(std::max(a_data.size(), b.size * size)); + c_data.reserve(std::max(a_data.size(), (b.size + 1) * size)); c_offsets.resize(size); for (size_t i = 0; i < size; ++i) LeastGreatestStringImpl::process(collator, a_data, a_offsets, b, c_data, c_offsets, i); diff --git a/tests/fullstack-test/mpp/issue_8604.test b/tests/fullstack-test/mpp/issue_8604.test new file mode 100644 index 00000000000..f0c4a6b2951 --- /dev/null +++ b/tests/fullstack-test/mpp/issue_8604.test @@ -0,0 +1,122 @@ +# Copyright 2023 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +mysql> DROP TABLE IF EXISTS test.`t1`; +mysql> CREATE TABLE test.`t1` (`col_timestamp_undef_signed` timestamp NULL DEFAULT NULL,`col_double_key_unsigned` double unsigned DEFAULT NULL,`col_char(20)_key_signed` char(20) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +mysql> INSERT INTO test.`t1` VALUES (NULL,0,'gg \n'),(NULL,NULL,'B'),('2005-02-23 04:13:26',12.991,'4'),(NULL,4,'yMKs'),('2001-11-08 18:27:17',1.009,'B'),('2010-02-23 06:14:47',0,'Y'),(NULL,NULL,'yMKs'),(NULL,0,'Abc'),(NULL,12,'y'),('2008-02-04 20:37:36',4,'gDZs'),('2012-01-18 02:28:51',12,'YmkS'),(NULL,NULL,'gg \n'),('2005-01-01 10:43:19',1.009,'-1'),('2003-09-05 18:26:28',1.009,' gg \n'),('2018-05-16 00:30:49',1,'B'),(NULL,1.009,NULL),('2014-04-21 05:08:31',4,'abc'),('2015-11-01 00:44:06',12.991,'B # y'),(NULL,12,'1'),(NULL,4,'yMKs'),(NULL,NULL,NULL),(NULL,NULL,'JLSF'),('2003-12-18 14:07:56',1,''),('2014-12-03 07:22:05',12.991,'ee '),('2008-04-04 08:24:36',0,'ee '),(NULL,10,'4'),(NULL,10,'4'),('2015-10-05 20:57:33',12.991,'0'),('2012-05-28 00:13:39',1,' cc \0'),('2004-07-10 09:11:34',4,'yMKs'),('2017-09-04 21:37:01',1,'10'),(NULL,12,'y'),('2005-07-03 10:21:31',4,'abc'),('2007-07-18 21:38:08',4,'jlsf'),(NULL,0,'JLSF'),('2017-10-01 03:01:35',1,' gg \n'),(NULL,4,'b'),(NULL,0,' B'),('2016-02-22 14:07:33',10,'yMKs'),(NULL,0,'4'),(NULL,12,'yMKs'),(NULL,10,NULL),('2000-05-04 04:52:55',12.991,'ee '),('2011-03-24 21:17:57',12,'y'),('2019-11-30 19:57:22',10,'Abc'),(NULL,0,' gg \n'),(NULL,0,'JLSF'),('2001-02-12 16:43:16',0,'10'),('2013-11-14 07:52:36',NULL,'0'),(NULL,12.991,'0'),('2009-12-15 14:49:46',10,'gDZs'),(NULL,10,'0'),(NULL,NULL,'-1'),(NULL,0,'4'),(NULL,NULL,'😉'),(NULL,1.009,'jlsf'),('2012-03-26 17:59:31',1.009,' gg \n'),('2014-04-06 13:46:32',12.991,'ee '),('2008-03-05 11:44:23',1.009,'B # y'),(NULL,12,'s160'),(NULL,12.991,' cc \0'),(NULL,1,'gDZs'),(NULL,NULL,'😉'),(NULL,0,'S160'),('2008-10-15 03:05:23',0,'GdzS'),('2014-05-11 14:09:08',10,'4'),('2013-04-09 07:09:17',1.009,'null'),('2007-06-12 10:23:04',1.009,'B # y'),('2019-05-25 09:01:14',4,NULL),('2006-11-15 00:28:05',12.991,NULL),(NULL,1.009,'ee '),('2005-11-12 13:44:04',1,'gDZs'),(NULL,12.991,'10'),('2012-01-16 07:20:03',NULL,'4'),(NULL,0,'gDZs'),('2002-09-15 04:17:02',1,'JLSF'),('2009-01-27 00:29:29',4,'S160'),(NULL,NULL,'Y'),('2014-11-10 09:11:18',1.009,'yMKs'),('2009-01-25 02:52:23',10,'b'),(NULL,0,'1'),('2002-03-18 09:32:53',0,'S160'),(NULL,NULL,'y'),('2016-12-01 13:21:55',10,'B # y'),('2014-11-12 15:41:32',12.991,'Y'),(NULL,NULL,'0'),('2012-05-19 19:08:15',12,' ee '),(NULL,12,'y'),(NULL,1,'y'),('2016-06-10 13:52:49',0,' B'),('2013-01-21 07:41:51',NULL,'0'),(NULL,0,NULL),(NULL,1.009,' ee '),('2017-06-01 20:14:09',0,' B'),('2017-04-15 22:38:57',10,'y'),(NULL,0,NULL),('2017-09-15 01:57:51',10,'10'),('2018-03-06 22:40:06',4,'b'),('2005-07-01 07:10:43',4,''),('2001-09-09 23:30:34',1,'GdzS'),(NULL,NULL,'ee '),('2017-02-27 08:52:32',10,'4'),('2009-01-06 17:18:39',12,'gg \n'),(NULL,4,'😉'),(NULL,0,NULL),('2010-02-22 22:15:07',10,'ee '),(NULL,10,'4'),(NULL,1,'ee '),(NULL,10,'gDZs'),('2009-03-19 06:53:23',12.991,'GdzS'),('2008-12-10 08:10:10',10,NULL),(NULL,12.991,'1'),('2001-03-12 23:36:38',0,'GdzS'),('2018-06-01 16:09:34',4,'Abc'),(NULL,10,' ee '),(NULL,10,'gDZs'),(NULL,0,'S160'),(NULL,0,'1'),('2015-07-24 13:00:56',1,'😉'),(NULL,NULL,NULL),(NULL,10,'gg \n'),(NULL,12.991,'b'),(NULL,10,NULL),('2008-02-09 14:24:22',12.991,'10'),(NULL,NULL,'gDZs'),('2012-09-21 23:28:30',1.009,'null'),(NULL,4,'yMKs'),(NULL,NULL,'cc \0'),('2013-04-07 01:03:05',NULL,'JLSF'),('2002-07-08 23:32:59',10,'B # y'),('2017-06-26 18:43:33',10,'abc'),('2018-11-14 17:04:42',4,NULL),(NULL,1.009,'b # c'),(NULL,10,'Abc'),('2003-04-10 02:12:02',12.991,'B # y'),(NULL,1,'B # y'),(NULL,1.009,'Y'),(NULL,NULL,'yMKs'),(NULL,12.991,'jlsf'),(NULL,NULL,' ee '),('2018-05-07 07:58:58',12,'y'),(NULL,12.991,''),('2019-06-11 08:48:43',4,'S160'),('2017-08-27 17:26:28',NULL,'😉'),('2000-05-18 19:55:08',4,'0'),('2003-05-25 06:05:35',4,' ee '),(NULL,1.009,'yMKs'),(NULL,1,'1'),('2005-03-22 16:09:59',1,'b # c'),('2017-04-07 20:45:03',12.991,'jlsf'),('2010-10-23 08:43:21',10,'y'),('2011-02-07 10:44:43',1,NULL),(NULL,1.009,'-1'),(NULL,NULL,'YmkS'),(NULL,12.991,'cc \0'),('2013-04-07 18:48:34',1.009,'1'),(NULL,0,NULL),('2009-03-17 21:09:57',12,' B'),(NULL,NULL,'B # y'),('2001-02-20 11:58:37',1,'b # c'),(NULL,1.009,'cc \0'),(NULL,12,' gg \n'),('2006-05-26 16:52:09',12.991,'null'),('2011-08-04 22:18:49',12,' gg \n'),('2010-08-20 16:10:46',12.991,'b # c'),(NULL,12.991,'1'),('2001-11-01 19:49:59',NULL,'jlsf'),('2004-05-15 20:00:12',0,'s160'),('2007-02-13 16:17:41',4,'abc'),(NULL,NULL,'b'),('2019-02-17 18:38:01',NULL,'abc'),('2015-10-31 23:56:10',12,'b'),('2004-02-17 21:25:41',12.991,' gg \n'),(NULL,4,'GdzS'),(NULL,4,'ee '),('2019-01-27 23:22:33',0,'gg \n'),('2017-03-23 09:21:08',0,'B # y'),(NULL,10,'GdzS'),(NULL,1.009,'S160'),(NULL,0,'jlsf'),('2007-09-06 10:40:58',1,'S160'),(NULL,12.991,'S160'),(NULL,1.009,NULL),(NULL,4,'gDZs'),(NULL,1.009,NULL),('2005-04-16 08:35:13',1,' gg \n'),(NULL,12.991,'GdzS'),('2013-04-17 12:12:42',4,'B'),(NULL,1.009,'gDZs'),(NULL,0,NULL),(NULL,12.991,'S160'),('2009-08-06 16:35:09',12.991,'ee '),(NULL,10,'jlsf'),(NULL,12,NULL),(NULL,1.009,'-1'),(NULL,1.009,'YmkS'),(NULL,NULL,'S160'),('2018-07-23 09:02:01',1,'-1'),(NULL,1.009,'jlsf'),(NULL,12,'gg \n'),('2000-08-14 10:11:21',NULL,NULL),('2007-05-21 19:50:23',12,' gg \n'),(NULL,4,' gg \n'),(NULL,12,NULL),(NULL,1,' B'),(NULL,1,'0'),(NULL,12.991,NULL),(NULL,12,'1'),('2006-03-14 03:42:41',10,'S160'),('2016-08-11 02:14:36',12,'null'),('2007-05-14 00:46:30',12,'GdzS'),(NULL,12.991,'😉'),('2009-06-12 16:57:50',0,' cc \0'),(NULL,4,'B'),(NULL,0,'yMKs'),('2011-10-23 22:37:36',12.991,'0'),(NULL,12,NULL),('2001-10-14 10:26:56',1.009,'1'),('2002-01-10 10:09:43',NULL,''),(NULL,4,'b'),('2019-09-17 02:09:32',1,'YmkS'),(NULL,1,'B'),(NULL,12.991,'null'); +mysql> insert into test.t1 values('2011-11-06 11:21:17',4,'gg \n'),(NULL,10,'gDZs'),('2004-01-08 09:46:27',0,'ee '),('2018-02-02 04:34:31',10,'b'),('2009-02-19 16:55:10',NULL,'y'),(NULL,12,'B'),(NULL,1.009,'4'),(NULL,12,'0'),('2014-08-18 01:55:13',1.009,'y'),(NULL,4,''),('2011-07-10 08:19:21',10,' B'),('2000-03-20 10:03:36',4,' B'),('2018-12-04 11:44:27',NULL,'YmkS'),(NULL,4,''),(NULL,10,'B'),('2014-05-07 08:57:15',12.991,'B # y'),(NULL,4,'S160'),(NULL,0,NULL),(NULL,0,NULL),('2017-12-11 22:41:32',10,'B # y'),('2015-05-21 18:18:56',10,'Y'),('2018-10-14 21:44:09',0,'b'),('2018-08-15 08:18:39',NULL,'abc'),('2004-04-20 02:27:21',12,'YmkS'),('2009-12-23 00:14:13',12.991,'s160'),(NULL,12,'Y'),('2010-04-10 21:59:06',NULL,'abc'),('2003-11-05 05:52:18',10,''),('2007-07-14 22:21:49',NULL,'S160'),('2011-04-06 06:41:20',4,NULL),(NULL,4,'Y'),('2017-11-14 16:38:52',12.991,NULL),(NULL,1,''),(NULL,12,'null'),(NULL,1,'4'),('2015-04-08 00:24:04',1.009,'-1'),('2011-07-02 02:26:27',4,'gg \n'),('2005-10-13 08:29:56',10,NULL),('2002-09-04 18:54:30',12.991,'-1'),(NULL,10,'y'),('2007-03-27 17:20:14',12,'GdzS'),(NULL,1,'4'),(NULL,1.009,'cc \0'),(NULL,12.991,'gDZs'),('2017-08-13 22:31:52',12.991,'abc'),('2006-03-14 21:51:50',12.991,'yMKs'),(NULL,NULL,'Abc'),(NULL,1,'S160'),(NULL,10,'1'),('2009-08-18 01:15:16',NULL,NULL),('2000-04-22 19:41:43',12,'gg \n'),('2009-03-25 18:18:34',1,' gg \n'),('2001-07-24 12:20:56',1.009,'cc \0'),(NULL,12.991,'ee '),(NULL,4,'yMKs'),('2019-11-20 15:59:31',1.009,'😉'),('2007-11-18 15:49:06',12,'cc \0'),('2011-10-11 20:03:43',4,' ee '),(NULL,1.009,'gg \n'),('2018-07-07 06:06:59',10,NULL),(NULL,12.991,'YmkS'),(NULL,NULL,'😉'),(NULL,10,'YmkS'),('2019-12-20 03:47:58',1,'Abc'),('2011-08-21 20:59:19',12,'gDZs'),('2014-11-18 12:57:38',12.991,NULL),(NULL,0,'gg \n'),('2001-01-15 20:56:07',NULL,'gg \n'),('2012-08-20 14:51:56',10,'B # y'),('2019-07-03 13:28:20',NULL,NULL),(NULL,4,'😉'),('2003-04-11 10:53:24',12.991,'gg \n'),('2000-06-09 23:46:02',1,'yMKs'),('2012-08-22 17:08:33',1,'null'),(NULL,4,' ee '),('2013-02-25 08:38:22',0,'b'),('2017-05-19 00:23:59',1.009,NULL),('2009-12-18 17:17:49',12,' gg \n'),(NULL,1.009,'b # c'),(NULL,4,NULL),('2004-10-28 02:13:04',12,'null'),(NULL,10,'😉'),(NULL,10,' ee '),(NULL,10,'cc \0'),(NULL,12.991,'cc \0'),('2010-07-11 06:38:37',1.009,'-1'),(NULL,1,'Y'),(NULL,1.009,NULL),('2016-06-28 07:03:42',4,NULL),(NULL,4,'YmkS'),('2017-02-11 22:48:31',1,NULL),('2019-10-02 01:27:20',4,'JLSF'),('2001-07-04 14:20:48',NULL,'jlsf'),(NULL,NULL,'GdzS'),(NULL,0,'0'),(NULL,4,'Y'),(NULL,0,'GdzS'),(NULL,12.991,'10'),('2004-05-27 16:44:09',1,'-1'),('2003-12-19 05:18:13',1,'yMKs'),(NULL,0,NULL),(NULL,12.991,NULL),('2014-04-13 03:10:49',4,'jlsf'),(NULL,0,'😉'),(NULL,NULL,'Y'),('2004-05-26 17:44:52',12,''),('2011-04-19 04:47:26',10,' ee '),(NULL,0,NULL),(NULL,0,'Y'),('2000-03-16 13:43:27',10,'null'),(NULL,10,'gDZs'),(NULL,12,'😉'),(NULL,4,'ee '),(NULL,1.009,'s160'),('2015-05-14 14:41:45',NULL,'1'),('2006-11-03 13:06:02',10,'-1'),('2011-07-31 13:32:03',12.991,'b # c'),(NULL,10,'yMKs'),('2019-03-19 19:40:35',NULL,'y'),('2003-01-19 12:57:41',12.991,'jlsf'),('2018-05-16 11:07:35',12,'b # c'),('2001-04-24 20:24:41',1.009,'y'),('2000-05-16 18:22:45',1.009,NULL),('2007-06-13 18:34:26',4,'yMKs'),('2015-07-07 05:18:06',0,NULL),(NULL,10,NULL),('2012-07-17 18:15:49',4,NULL),('2011-07-25 16:38:39',NULL,'ee '),('2000-07-22 20:03:14',12.991,'jlsf'),('2013-03-18 05:50:23',12,NULL),(NULL,0,' gg \n'),('2002-03-07 02:43:40',1.009,'JLSF'),('2011-01-18 01:09:05',1.009,'gDZs'),(NULL,0,'10'),('2014-10-11 15:06:47',1,'Abc'),(NULL,0,NULL),(NULL,4,'1'),(NULL,4,'GdzS'),(NULL,0,'yMKs'),('2006-04-08 00:13:43',12,'cc \0'),('2007-10-25 13:45:48',10,''),(NULL,NULL,'Y'),('2002-10-05 04:54:51',1.009,'yMKs'),(NULL,1,'b'),(NULL,NULL,'b # c'),(NULL,12.991,' cc \0'),(NULL,4,'JLSF'),(NULL,NULL,'Abc'),(NULL,12.991,'4'),(NULL,1,'b'),('2004-01-02 00:26:39',1,''),('2002-07-07 01:49:17',10,'gg \n'),('2005-06-16 00:25:00',4,' cc \0'),(NULL,0,'JLSF'),(NULL,10,NULL),('2011-04-13 10:44:56',4,'10'),('2011-03-20 20:01:38',4,' gg \n'),(NULL,10,'y'),('2011-05-08 05:03:53',1,'B'),('2005-06-10 05:46:04',12.991,'null'),('2002-03-06 08:58:40',4,'YmkS'),(NULL,4,'B'),(NULL,1.009,'Abc'),('2000-03-24 11:05:18',4,'4'),('2010-03-26 12:51:28',12.991,' gg \n'),('2008-10-16 23:18:05',0,'JLSF'),('2011-04-07 14:41:24',1.009,'null'),(NULL,10,'B # y'),(NULL,12.991,'y'),('2018-11-22 09:21:41',0,'y'),('2004-02-02 18:25:06',NULL,'Abc'),('2013-09-16 14:36:47',1.009,'jlsf'),(NULL,10,'ee '),('2019-11-14 04:47:41',10,'S160'),(NULL,NULL,'b'),(NULL,4,'s160'); +mysql> insert into test.t1 values('2013-12-19 23:07:29',1,'b'),('2019-06-27 08:04:16',1.009,'null'),('2006-05-22 17:39:49',0,' gg \n'),('2014-02-06 13:08:12',NULL,'jlsf'),(NULL,4,' ee '),('2013-10-31 09:22:02',1,'gg \n'),('2007-02-08 09:03:47',12.991,'s160'),('2003-12-16 07:38:29',4,NULL),('2019-09-30 20:32:43',1,NULL),(NULL,1,'Y'),(NULL,12.991,'gDZs'),('2000-07-16 04:24:36',0,NULL),(NULL,1.009,'gDZs'),('2011-08-07 09:12:36',10,' ee '),('2018-03-05 00:46:44',NULL,NULL),('2008-02-25 03:54:08',4,'YmkS'),('2004-03-22 23:47:29',4,'GdzS'),(NULL,12,'B # y'),('2012-11-27 11:53:49',10,NULL),(NULL,4,'😉'),('2007-01-08 01:20:44',1,'gDZs'),('2016-08-27 00:14:54',1.009,'gg \n'),('2003-12-19 23:59:22',12.991,'s160'),('2000-05-17 22:12:58',0,'B # y'),('2019-03-03 06:19:19',10,'Abc'),(NULL,4,'0'),('2018-01-04 02:30:31',NULL,'gDZs'),('2007-01-18 14:39:52',NULL,'b # c'),('2007-01-07 20:07:28',10,'😉'),(NULL,4,NULL),(NULL,NULL,'Abc'),('2019-02-16 17:24:04',1,' ee '),('2016-05-28 05:13:34',NULL,'B # y'),('2004-12-14 14:32:24',12.991,'b # c'),('2018-12-13 08:03:28',12.991,'S160'),(NULL,4,'cc \0'),('2015-12-26 18:31:31',NULL,' B'),(NULL,0,'abc'),(NULL,4,' gg \n'),(NULL,12,'GdzS'),(NULL,12,'B'),('2008-12-25 16:59:51',12.991,' B'),('2014-11-06 03:14:33',10,NULL),(NULL,12.991,'-1'),('2006-01-15 09:23:36',1.009,'ee '),(NULL,1,'B # y'),('2012-02-23 18:32:26',12,'s160'),(NULL,10,'jlsf'),(NULL,NULL,' cc \0'),('2009-10-25 00:23:00',0,''),(NULL,10,'gg \n'),(NULL,12,NULL),(NULL,10,NULL),('2003-12-02 05:23:26',1.009,'GdzS'),('2008-03-11 00:25:54',0,'B'),(NULL,12,'gg \n'),(NULL,1,'S160'),(NULL,12,'Abc'),(NULL,1,'abc'),(NULL,NULL,'b'),(NULL,12.991,'y'),('2019-04-27 04:45:20',12,'Y'),('2019-11-03 21:36:13',4,NULL),(NULL,12.991,'s160'),(NULL,NULL,'s160'),('2008-01-19 04:47:46',12.991,'-1'),('2012-08-07 23:01:27',12,' gg \n'),('2010-05-31 09:02:34',NULL,' gg \n'),('2017-11-30 09:46:27',0,'S160'),('2002-09-12 04:30:53',10,NULL),(NULL,12,' B'),('2003-10-27 07:20:11',12,'s160'),('2018-09-13 08:27:52',12,''),('2007-04-30 17:20:32',10,'gDZs'),('2009-10-19 22:39:51',10,' B'),(NULL,12,' ee '),(NULL,1.009,NULL),(NULL,10,NULL),('2012-03-12 11:27:49',1.009,'s160'),(NULL,10,'s160'),(NULL,4,NULL),(NULL,0,'gg \n'),(NULL,1.009,'cc \0'),(NULL,12,NULL),(NULL,0,'10'),(NULL,1,'b'),('2001-08-04 20:53:52',12,NULL),('2014-01-08 13:22:57',12.991,'ee '),('2014-05-12 19:41:24',12,'abc'),('2019-12-04 18:54:32',0,'GdzS'),(NULL,4,'null'),(NULL,1.009,'-1'),(NULL,1,'Y'),(NULL,4,' cc \0'),(NULL,12.991,''),(NULL,10,''),('2005-04-19 00:29:46',NULL,'jlsf'),(NULL,4,'10'),('2015-04-18 23:16:16',NULL,' ee '),(NULL,12,'4'),(NULL,10,'gg \n'),('2001-08-03 21:17:55',4,'jlsf'),('2014-02-15 09:11:58',1.009,' cc \0'),('2018-01-27 14:04:36',1,'gDZs'),('2009-07-05 10:29:15',1.009,'Abc'),(NULL,4,' B'),('2016-05-09 06:57:21',1,'B'),(NULL,0,'😉'),(NULL,12,'b # c'),('2014-03-23 15:12:11',NULL,'b # c'),('2008-03-19 06:38:00',12.991,'B # y'),('2014-07-24 17:29:04',4,NULL),(NULL,1,'s160'),(NULL,1,'null'),(NULL,1.009,'10'),('2002-07-26 19:43:11',12,'-1'),('2003-10-02 04:55:19',12,'jlsf'),(NULL,0,'Abc'),(NULL,12.991,'-1'),('2003-06-22 12:47:41',1,'10'),('2009-08-15 12:55:01',4,'GdzS'),(NULL,4,'😉'),('2017-03-04 20:07:47',12.991,'GdzS'),(NULL,4,'yMKs'),(NULL,10,'null'),(NULL,12.991,'null'),(NULL,10,'10'),(NULL,12,' gg \n'),(NULL,12.991,NULL),(NULL,NULL,'yMKs'),(NULL,12.991,'y'),(NULL,12.991,'B'),('2002-05-21 06:47:28',0,'gg \n'),(NULL,12.991,'B # y'),(NULL,1,NULL),('2006-02-12 22:05:10',12,NULL),(NULL,NULL,'B # y'),(NULL,0,'-1'),(NULL,12.991,'1'),(NULL,12.991,' gg \n'),(NULL,1.009,'b # c'),('2008-03-19 22:30:17',12.991,'JLSF'),('2004-05-28 02:16:41',1,NULL),('2001-12-13 10:38:17',12,'B'),(NULL,1,''),('2015-01-03 02:41:44',0,'B'),(NULL,12.991,'y'),(NULL,0,'😉'),('2005-09-07 07:10:02',NULL,NULL),('2003-08-10 07:47:19',1,'JLSF'),(NULL,12,'😉'),(NULL,4,'-1'),('2008-03-08 12:57:13',12,'YmkS'),('2003-04-12 12:02:48',12,'b # c'),('2007-09-14 09:10:07',0,' B'),(NULL,12.991,'0'),('2004-06-22 16:17:00',1,''),(NULL,4,'Y'),('2003-12-21 07:15:32',1,'Abc'),(NULL,12,'cc \0'),('2018-03-24 19:54:43',10,NULL),(NULL,12.991,NULL),(NULL,1,'gDZs'),(NULL,NULL,'ee '),(NULL,1,'yMKs'),(NULL,1.009,'10'),(NULL,12.991,'Abc'),('2012-07-05 11:57:01',1.009,NULL),('2017-06-20 23:18:24',NULL,NULL),(NULL,10,'B'),(NULL,1,''),(NULL,4,'😉'),('2000-06-02 09:23:56',1,' cc \0'),(NULL,12,'cc \0'),(NULL,0,'1'),(NULL,12.991,'10'),(NULL,4,'B # y'),(NULL,12.991,'😉'),(NULL,4,'4'),(NULL,12.991,' gg \n'),('2014-06-26 01:26:38',NULL,'b'),('2015-06-16 06:56:04',1.009,'gg \n'),('2018-02-01 02:59:10',NULL,'null'),('2019-11-03 11:49:43',1.009,' B'),(NULL,0,'yMKs'),(NULL,NULL,'abc'),('2001-06-04 13:12:25',0,NULL),('2018-02-21 00:54:57',1,'abc'),('2008-02-25 17:02:05',4,'b'),('2000-08-23 17:35:29',4,'0'),(NULL,10,'gDZs'),('2018-02-09 01:52:09',10,''),('2007-08-25 08:12:10',1.009,'4'),('2015-08-11 19:52:37',NULL,'S160'),('2001-02-22 12:56:18',1,'cc \0'),('2002-10-21 20:23:23',10,'ee '),(NULL,1,' B'),(NULL,NULL,'-1'),('2016-04-08 06:22:18',12,' cc \0'),(NULL,4,' gg \n'),('2003-10-28 02:57:57',4,'y'),('2004-05-15 21:07:03',12,'null'),(NULL,12.991,'abc'),('2018-06-08 22:29:21',10,' B'),(NULL,12.991,'y'),('2019-08-19 19:48:16',NULL,'B'),('2008-08-10 13:37:02',12.991,' cc \0'),('2007-08-18 09:10:37',0,'abc'),(NULL,4,'gg \n'),(NULL,4,NULL),(NULL,4,'Abc'),(NULL,12,'ee '),('2008-03-22 05:50:53',0,' cc \0'),('2010-11-06 13:16:41',12,'jlsf'),('2004-05-09 06:01:51',1,'cc \0'); +mysql> insert into test.t1 values('2013-12-17 23:12:18',NULL,NULL),('2018-09-02 03:41:16',12,'cc \0'),('2015-08-16 04:26:02',10,NULL),(NULL,12.991,'Abc'),('2000-07-11 03:04:34',1,'1'),('2004-03-18 16:55:04',12.991,'S160'),('2005-02-18 05:21:30',1.009,'gDZs'),('2018-09-01 08:02:20',12,'gg \n'),('2013-06-01 10:12:55',1.009,'yMKs'),('2013-12-21 03:47:32',1,'jlsf'),(NULL,1.009,'null'),('2005-12-14 20:18:40',1,'s160'),('2011-12-18 23:11:37',12,'1'),('2011-03-07 23:52:00',NULL,'b'),('2003-05-16 20:59:52',NULL,'1'),(NULL,12,'Abc'),(NULL,0,''),('2014-03-10 01:52:50',1,NULL),(NULL,10,' gg \n'),('2007-08-23 00:38:57',4,'Abc'),('2013-06-05 10:50:06',NULL,'b'),('2003-03-10 20:56:17',1.009,'b # c'),(NULL,12.991,'B # y'),('2008-02-29 14:55:55',1.009,'Y'),(NULL,12,'cc \0'),('2011-09-18 10:03:51',12,NULL),(NULL,1.009,'JLSF'),(NULL,NULL,'s160'),(NULL,1.009,'jlsf'),('2002-12-17 22:26:46',1,'JLSF'),('2018-05-02 23:16:54',10,'jlsf'),(NULL,10,' gg \n'),(NULL,12,'y'),(NULL,1,'ee '),(NULL,0,'0'),(NULL,12,'Abc'),('2013-03-09 20:31:10',1,'y'),(NULL,NULL,'abc'),('2018-05-22 19:13:35',1.009,'jlsf'),(NULL,10,'cc \0'),('2012-11-30 11:31:29',0,'😉'),(NULL,1.009,' B'),('2007-04-11 18:07:29',12,'s160'),('2007-05-13 18:29:05',12,'b # c'),('2016-08-21 07:00:20',12,'B # y'),(NULL,0,NULL),(NULL,0,'JLSF'),(NULL,NULL,''),('2015-04-09 05:28:57',1.009,'B # y'),(NULL,1,'B # y'),(NULL,4,NULL),('2001-08-06 15:12:31',12.991,'YmkS'),(NULL,1,'0'),(NULL,10,' cc \0'),('2015-06-28 02:36:56',10,'-1'),('2007-07-09 03:20:44',4,'-1'),('2001-01-08 03:27:22',12,'4'),('2002-09-17 12:02:15',1,'cc \0'),('2000-07-03 08:30:26',4,NULL),(NULL,NULL,'jlsf'),('2003-03-13 08:30:46',1,NULL),(NULL,1,'null'),('2017-02-22 08:32:00',0,'B'),('2008-01-01 03:29:25',1.009,'Abc'),(NULL,0,' ee '),(NULL,4,' cc \0'),(NULL,1,'gDZs'),('2016-01-05 05:24:44',NULL,'0'),(NULL,12.991,''),('2001-06-06 23:34:04',1,'gDZs'),(NULL,NULL,'abc'),('2018-03-02 08:50:55',NULL,'1'),(NULL,1.009,NULL),(NULL,12,NULL),('2005-12-17 00:00:29',12,NULL),('2003-08-06 08:45:43',1.009,'10'),('2013-06-13 19:32:42',0,' B'),('2018-05-05 23:36:23',12.991,'ee '),('2003-07-14 10:54:10',10,'GdzS'),(NULL,10,'4'),(NULL,1.009,'yMKs'),(NULL,4,'jlsf'),('2004-03-15 23:42:28',12.991,' B'),(NULL,4,'Y'),(NULL,12,'y'),(NULL,10,'😉'),(NULL,12,'JLSF'),(NULL,1.009,'4'),(NULL,4,'4'),(NULL,NULL,'cc \0'),('2012-07-09 08:38:41',12,'10'),('2015-10-15 22:21:49',0,'YmkS'),(NULL,4,' B'),('2017-04-13 17:33:09',12.991,' gg \n'),(NULL,12,''),('2007-05-24 20:04:16',1.009,'B # y'),(NULL,1.009,'10'),(NULL,0,'10'),('2013-03-23 09:48:11',4,'null'),('2004-06-30 12:00:02',NULL,'😉'),(NULL,10,'jlsf'),('2011-03-01 20:46:58',NULL,'b'),(NULL,12,NULL),('2000-11-12 17:23:39',10,'gg \n'),(NULL,1.009,'B'),('2005-03-20 21:17:26',12,' cc \0'),(NULL,1.009,'S160'),('2015-07-10 18:11:22',12.991,'B # y'),('2006-02-17 16:08:51',4,'JLSF'),('2000-07-26 23:42:55',0,'b # c'),('2019-10-23 07:34:28',1.009,'1'),('2001-02-06 21:14:11',1,'JLSF'),(NULL,10,'b # c'),(NULL,10,'S160'),(NULL,1,'B # y'),('2014-02-10 18:23:03',0,'YmkS'),(NULL,1.009,'s160'),('2006-07-13 00:52:16',1.009,NULL),(NULL,10,'b # c'),(NULL,12.991,'B # y'),('2006-07-26 19:52:41',10,'gDZs'),(NULL,12,'YmkS'),(NULL,1.009,''),('2018-12-02 00:34:44',1,'cc \0'),('2010-05-07 11:49:05',1.009,'null'),(NULL,1,'S160'),(NULL,0,'10'),(NULL,12,' B'),(NULL,12,'jlsf'),('2000-02-20 07:57:15',10,'B'),('2002-02-26 13:36:04',12.991,'y'),('2004-09-21 13:21:04',1.009,'B'),(NULL,4,'Abc'),(NULL,1.009,'jlsf'),(NULL,NULL,NULL),('2014-12-04 19:47:14',10,'ee '),('2003-12-06 06:59:43',12,'10'),(NULL,0,'null'),('2004-11-07 09:20:14',12.991,'1'),('2011-07-22 07:09:19',0,' cc \0'); +mysql> insert into test.t1 values('2012-03-04 09:16:57',NULL,'gg \n'),('2005-04-17 09:32:12',10,'B # y'),(NULL,12,'B'),('2016-07-21 18:22:30',10,' ee '),('2002-08-14 20:36:13',NULL,' ee '),(NULL,NULL,'gg \n'),(NULL,1.009,'gg \n'),(NULL,10,'YmkS'),(NULL,10,'Abc'),('2010-07-24 22:26:37',0,NULL),(NULL,4,'B'),('2011-07-13 00:18:07',0,'gDZs'),(NULL,4,''),(NULL,12,'1'),('2013-11-17 17:10:51',4,'jlsf'),('2004-04-09 15:59:23',10,'ee '),(NULL,10,'B # y'),(NULL,1.009,' gg \n'),(NULL,1,NULL),('2003-05-13 11:37:26',12.991,'yMKs'),('2019-06-16 07:13:44',0,'JLSF'),('2015-07-08 22:02:05',10,'yMKs'),('2012-08-16 05:43:52',12.991,'y'),('2013-12-21 17:45:14',1,NULL),('2008-10-18 17:49:03',1,'GdzS'),(NULL,4,'S160'),('2003-04-10 09:04:27',0,NULL),('2004-02-06 17:36:29',NULL,NULL),(NULL,12,'jlsf'),('2009-03-06 08:23:15',10,'b'),(NULL,1,'JLSF'),('2018-06-28 07:16:45',12.991,'gg \n'),(NULL,4,'Y'),('2006-04-22 20:41:44',12,'ee '),('2015-11-22 19:20:28',12.991,'1'),(NULL,12.991,'gg \n'),('2014-07-25 07:01:58',NULL,'10'),('2003-03-12 20:15:42',4,NULL),('2012-02-05 04:47:43',0,'YmkS'),('2004-05-02 07:54:59',12,'10'),('2014-04-23 12:13:19',12,'b # c'),('2012-11-26 13:57:48',1,'B # y'),(NULL,10,NULL),(NULL,12.991,NULL),(NULL,10,'cc \0'),('2008-11-02 08:24:14',12.991,'0'),(NULL,12.991,'yMKs'),('2007-12-03 13:00:30',0,'4'),(NULL,0,'S160'),(NULL,1.009,'B # y'),(NULL,0,NULL),('2017-05-24 11:06:20',1.009,'YmkS'),('2018-10-12 05:16:44',1.009,NULL),('2007-04-03 04:08:03',4,NULL),(NULL,1,'Abc'),('2017-07-03 14:24:11',12,' gg \n'),(NULL,10,'null'),(NULL,NULL,' cc \0'),(NULL,NULL,'YmkS'),(NULL,12.991,'B # y'),('2006-11-19 10:30:10',1.009,'y'),('2014-07-26 01:20:24',1.009,'Y'),(NULL,4,' cc \0'),(NULL,1,' ee '),('2019-02-14 17:41:52',0,'😉'),('2010-12-15 04:31:12',12,'cc \0'),(NULL,1,'jlsf'),(NULL,12.991,'0'),('2001-06-17 15:23:35',12,'jlsf'),('2000-09-20 00:47:22',0,'ee '),(NULL,12,' ee '),(NULL,4,'null'),(NULL,0,'b # c'),(NULL,10,NULL),(NULL,0,NULL),('2013-02-15 22:28:16',1.009,'-1'),(NULL,12,'B # y'),('2001-02-11 14:36:58',1.009,NULL),(NULL,4,NULL),(NULL,12,'gg \n'),('2015-08-19 06:30:05',4,'Y'),('2000-01-18 15:23:50',NULL,NULL),(NULL,NULL,'yMKs'),('2010-10-02 20:29:32',1.009,'gg \n'),(NULL,10,'y'),(NULL,12.991,'B # y'),(NULL,NULL,' B'),(NULL,10,'JLSF'),('2010-07-23 12:24:33',NULL,'y'),(NULL,1,''),(NULL,NULL,' cc \0'),(NULL,NULL,'Y'),('2000-04-11 15:47:09',NULL,'10'),(NULL,10,'B'),('2018-08-17 04:35:55',12,'YmkS'),('2003-07-03 07:01:43',1.009,'10'),('2001-12-05 17:05:07',1.009,'null'),(NULL,12.991,'gDZs'),('2011-01-21 12:06:27',10,'-1'),(NULL,12,NULL),(NULL,12.991,'abc'),('2002-07-03 15:35:15',1,'4'),(NULL,1.009,'ee '),(NULL,0,'4'),(NULL,12,'Abc'),(NULL,1,'YmkS'),(NULL,1.009,''),('2016-05-19 12:15:28',1,'yMKs'),(NULL,12.991,'10'),('2010-11-27 12:05:50',0,'b # c'),('2014-11-30 11:06:55',0,'b # c'),(NULL,12,'B # y'),('2010-06-16 13:38:42',12,'YmkS'),('2008-08-14 07:33:46',NULL,NULL),('2019-01-09 03:19:51',10,' gg \n'),(NULL,4,'gg \n'),('2017-08-11 13:11:54',12,'-1'),(NULL,12.991,'B # y'),(NULL,4,'10'),(NULL,NULL,'cc \0'),('2010-04-22 17:35:37',NULL,NULL),('2013-04-24 10:04:39',1.009,'yMKs'),('2002-06-21 11:55:12',1.009,'YmkS'),('2003-06-16 17:44:27',10,'1'),(NULL,1.009,'gDZs'),('2007-10-18 20:44:20',12,NULL),('2017-01-04 11:55:39',4,'GdzS'),('2010-05-23 12:00:42',0,'GdzS'),(NULL,0,' cc \0'); +mysql> insert into test.t1 values('2015-06-09 11:04:49',1,NULL),(NULL,NULL,'0'),('2009-08-19 05:24:48',12.991,' ee '),(NULL,12.991,'B'),(NULL,0,' B'),(NULL,NULL,' B'),('2007-10-22 20:30:13',0,'null'),('2011-10-17 03:06:02',4,'Abc'),(NULL,10,'1'),(NULL,12.991,'B # y'),('2015-12-27 06:10:08',10,'10'),('2000-03-22 15:41:01',10,' gg \n'),(NULL,1.009,'cc \0'),('2019-07-19 22:56:20',12.991,'S160'),('2014-08-31 12:45:42',NULL,' ee '),(NULL,0,'b'),(NULL,0,'ee '),('2009-10-01 06:09:13',12.991,'B # y'),('2014-06-08 22:51:04',0,'jlsf'),(NULL,12.991,'B # y'),(NULL,NULL,' cc \0'),(NULL,NULL,'0'),('2000-10-18 21:41:16',12.991,NULL),('2001-10-27 20:38:54',10,'Abc'),(NULL,4,'Abc'),('2013-11-01 02:48:53',10,'gDZs'),(NULL,NULL,'YmkS'),(NULL,12.991,'Y'),('2014-03-11 12:53:12',4,'Abc'),(NULL,NULL,'10'),(NULL,12,'abc'),(NULL,1.009,NULL),(NULL,12.991,NULL),(NULL,10,'S160'),(NULL,4,'B'),('2016-10-01 21:21:17',NULL,'YmkS'),('2012-08-14 11:29:32',1,'YmkS'),(NULL,1,'Y'),(NULL,10,NULL),('2006-04-24 13:18:47',12.991,'null'),('2001-01-27 06:26:42',1,'-1'),(NULL,NULL,'JLSF'),('2000-11-16 15:49:08',NULL,'JLSF'),(NULL,NULL,'yMKs'),('2011-11-25 02:30:30',1,'B'),('2013-06-13 19:26:04',0,'😉'),(NULL,0,'0'),('2008-02-29 17:34:14',12,'GdzS'),('2006-12-14 01:16:59',12.991,'yMKs'),('2008-03-22 07:29:29',4,'JLSF'),('2015-05-05 22:08:14',1.009,'4'),('2009-07-08 21:29:03',1.009,'YmkS'),('2016-03-04 18:42:34',12,'b'),(NULL,NULL,'-1'),('2003-06-04 12:15:28',1,'😉'),('2005-11-17 15:22:32',1.009,'10'),(NULL,0,'0'),(NULL,10,'GdzS'),('2007-02-10 04:52:00',4,'abc'),(NULL,10,'null'),(NULL,10,NULL),(NULL,10,'0'),('2008-02-08 20:53:17',1.009,NULL),('2004-01-10 21:25:06',NULL,'cc \0'),(NULL,NULL,'b # c'),(NULL,10,'0'),('2013-09-16 21:15:47',10,'1'),('2009-09-07 02:07:54',4,'cc \0'),('2019-07-18 12:05:13',12,'abc'),(NULL,10,'null'),(NULL,12.991,'abc'),('2006-01-25 13:17:33',1.009,'😉'),('2009-02-17 08:59:39',0,'gDZs'),(NULL,0,'10'),('2001-04-21 17:48:24',4,'b'),(NULL,NULL,'1'),(NULL,10,'B # y'),('2018-05-02 10:13:06',10,'abc'),(NULL,0,'B'),('2007-10-25 09:01:28',1,' gg \n'),('2002-04-21 15:34:35',1.009,'JLSF'),(NULL,0,' ee '),('2001-07-06 19:30:11',1.009,'abc'),('2015-11-17 03:33:12',1,' gg \n'),('2009-11-19 23:52:57',10,'gg \n'),('2005-02-08 13:12:53',12,'😉'),(NULL,4,'B # y'),(NULL,12.991,'null'),(NULL,12.991,'4'),('2010-10-19 20:38:50',1.009,'GdzS'),(NULL,0,'1'),('2019-06-08 02:28:11',12.991,'😉'),(NULL,NULL,''),('2017-12-05 17:06:36',1,' B'),('2010-11-05 17:24:39',1.009,'GdzS'),(NULL,0,'10'),('2009-04-20 13:20:34',NULL,'JLSF'),(NULL,0,'b'),('2005-05-20 12:34:10',NULL,'gDZs'),(NULL,12,NULL),(NULL,4,'yMKs'),('2014-07-04 00:21:20',4,' gg \n'),(NULL,12.991,'-1'),('2018-05-17 11:48:05',NULL,'y'),('2018-02-09 18:12:10',1.009,'gg \n'),(NULL,4,'s160'),('2015-03-06 08:27:21',1.009,'1'),(NULL,0,'b'),('2016-02-01 12:30:34',12,'Y'),('2013-09-12 06:40:43',1.009,'ee '),(NULL,12,'y'),(NULL,12,'ee '),(NULL,0,NULL),('2010-05-03 03:15:30',1.009,'yMKs'),('2003-04-21 02:55:04',0,NULL),(NULL,4,'yMKs'),(NULL,12,' cc \0'); +mysql> DROP TABLE IF EXISTS test.`t2`; +mysql> CREATE TABLE test.`t2` (`col_int_key_unsigned` int(10) unsigned DEFAULT NULL,`col_int_undef_unsigned` int(10) unsigned DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +mysql> INSERT INTO test.`t2` VALUES (4,0),(NULL,10),(13,NULL),(13,NULL),(10,NULL),(1,0),(NULL,0),(NULL,1),(4,4),(0,13),(1,1),(NULL,10),(13,1),(13,4),(13,1),(1,12),(1,12),(1,0),(0,13),(10,10),(1,1),(1,12),(10,0),(13,13),(13,1),(1,1),(NULL,10),(NULL,10),(4,12),(4,NULL),(1,13),(0,12),(12,13),(10,12),(0,12),(4,13),(1,0),(1,1),(1,13),(13,13),(12,13),(1,1),(10,1),(NULL,NULL),(10,12),(13,1),(12,0),(4,1),(12,4),(12,12),(13,12),(12,NULL),(13,13),(1,0),(12,13),(4,0),(1,NULL),(1,4),(1,1),(13,NULL),(13,1),(4,10),(10,NULL),(NULL,1),(10,4),(13,NULL),(1,1),(1,4),(13,0),(13,13),(13,NULL),(1,12),(12,12),(NULL,13),(13,NULL); +mysql> DROP TABLE IF EXISTS test.`t3`; +mysql> CREATE TABLE test.`t3` (`col_varchar(20)_key_signed` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +mysql> INSERT INTO test.`t3` VALUES ('null'),('JLSF'),('jlsf'),('B'),('Y'),('y'),(NULL),('0'),('1'),(''); +mysql> alter table test.`t1` set tiflash replica 1; +mysql> alter table test.`t2` set tiflash replica 1; +mysql> alter table test.`t3` set tiflash replica 1; +mysql> analyze table test.`t1` ; +mysql> analyze table test.`t2` ; +mysql> analyze table test.`t3` ; + +func> wait_table test t1 +func> wait_table test t2 +func> wait_table test t3 + +mysql> use test; SELECT count(*) FROM t1; ++----------+ +| count(*) | ++----------+ +| 1000 | ++----------+ +mysql> use test; SELECT count(*) FROM t2; ++----------+ +| count(*) | ++----------+ +| 75 | ++----------+ +mysql> use test; SELECT count(*) FROM t3; ++----------+ +| count(*) | ++----------+ +| 10 | ++----------+ +### it is a random issue, so run the query multiple times +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ +mysql> use test; SELECT count(*) FROM t1 left join t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`; ++----------+ +| count(*) | ++----------+ +| 205318 | ++----------+ + +mysql> DROP TABLE IF EXISTS test.`t1`; +mysql> DROP TABLE IF EXISTS test.`t2`; +mysql> DROP TABLE IF EXISTS test.`t3`;