Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: indexJoin error resulted from copy after inline projection #15299

Closed
fzhedu opened this issue Mar 11, 2020 · 0 comments · Fixed by #15411
Closed

executor: indexJoin error resulted from copy after inline projection #15299

fzhedu opened this issue Mar 11, 2020 · 0 comments · Fixed by #15411
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@fzhedu
Copy link
Contributor

fzhedu commented Mar 11, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

Modify the source code to set

diff --git a/sessionctx/variable/tidb_vars.go b/sessionctx/variable/tidb_vars.go

-       DefInitChunkSize                   = 32
-       DefMaxChunkSize                    = 1024
+       DefInitChunkSize                   = 2
+       DefMaxChunkSize                    = 2

diff --git a/sessionctx/variable/varsutil.go b/sessionctx/variable/varsutil.go
-       maxChunkSizeLowerBound = 32
+       maxChunkSizeLowerBound = 1

CREATE TABLE `Q` (
  `col_varchar_1024_latin1_key` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `col_varchar_10_utf8_not_null` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `col_varchar_1024_utf8_not_null` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `col_varchar_1024_latin1_not_null` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `col_int` int(11) DEFAULT NULL,
  `col_varchar_10_latin1` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `col_varchar_1024_utf8_not_null_key` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `col_varchar_10_utf8` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `col_varchar_1024_utf8_key` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `col_varchar_1024_latin1` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `col_varchar_10_latin1_key` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `col_int_not_null_key` int(11) NOT NULL,
  `col_varchar_10_latin1_not_null` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `col_varchar_1024_utf8` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `col_varchar_10_latin1_not_null_key` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `pk` int(11) NOT NULL AUTO_INCREMENT,
  `col_int_key` int(11) DEFAULT NULL,
  `col_varchar_10_utf8_not_null_key` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `col_varchar_10_utf8_key` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `col_int_not_null` int(11) NOT NULL,
  `col_varchar_1024_latin1_not_null_key` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  PRIMARY KEY (`pk`),
  KEY `col_varchar_1024_latin1_key` (`col_varchar_1024_latin1_key`(1000)),
  KEY `col_varchar_1024_utf8_not_null_key` (`col_varchar_1024_utf8_not_null_key`(333)),
  KEY `col_varchar_1024_utf8_key` (`col_varchar_1024_utf8_key`(333)),
  KEY `col_varchar_10_latin1_key` (`col_varchar_10_latin1_key`),
  KEY `col_int_not_null_key` (`col_int_not_null_key`),
  KEY `col_varchar_10_latin1_not_null_key` (`col_varchar_10_latin1_not_null_key`),
  KEY `col_int_key` (`col_int_key`),
  KEY `col_varchar_10_utf8_not_null_key` (`col_varchar_10_utf8_not_null_key`),
  KEY `col_varchar_10_utf8_key` (`col_varchar_10_utf8_key`),
  KEY `col_varchar_1024_latin1_not_null_key` (`col_varchar_1024_latin1_not_null_key`(1000))
) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
INSERT INTO `Q` VALUES ('d','r','x','b',2,'h','l','i','c','q',NULL,6,'n','l','s',1,7,'m','j',9,'b');
INSERT INTO `Q` VALUES ('e','f','a','c',NULL,NULL,'l',NULL,NULL,'g','a',3,'k','g','o',2,6,'q',NULL,8,'a');
INSERT INTO `Q` VALUES ('t','w','d','y',4,'r','s',NULL,'k','j',NULL,9,'q','b','b',3,4,'j','n',8,'o');
INSERT INTO `Q` VALUES ('g','g','f','m',0,NULL,'t','z','b',NULL,NULL,7,'m','p','l',4,6,'l',NULL,3,'h');
INSERT INTO `Q` VALUES ('j','q','p','q',3,NULL,'c',NULL,'g','t','m',1,'z','t','h',5,0,'c',NULL,9,'c');
INSERT INTO `Q` VALUES ('q','l','i','j',0,'z','c',NULL,'s','q','a',8,'m','i','s',6,0,'y',NULL,5,'t');
INSERT INTO `Q` VALUES ('f','t','g','l',NULL,'w','l','e','u','t','b',1,'q','i','u',7,NULL,'k','g',0,'f');
INSERT INTO `Q` VALUES ('y','d','v','c',7,'v','m','e','c',NULL,'g',2,'f','t','l',8,1,'h','k',5,'q');
INSERT INTO `Q` VALUES (NULL,'a','u','l',5,'q','h','h','q','i',NULL,6,'w','p','q',9,NULL,'v','l',4,'y');
INSERT INTO `Q` VALUES ('y','n','k','c',NULL,NULL,'n','y','g','u','c',5,'j','g','f',10,1,'s','c',8,'i');
INSERT INTO `Q` VALUES ('y','o','p','q',NULL,NULL,'f','c','m',NULL,'e',2,'j','g','t',11,3,'a',NULL,8,'a');
INSERT INTO `Q` VALUES ('i','g','i','t',2,'s','b','m','r','d','h',4,'e',NULL,'c',12,6,'z','b',6,'k');
INSERT INTO `Q` VALUES (NULL,'e','j','u',6,NULL,'r',NULL,'j',NULL,'g',7,'h',NULL,'a',13,6,'w','b',8,'e');
INSERT INTO `Q` VALUES ('i','p','n','j',2,'c','v','m',NULL,'p','t',4,'s',NULL,'c',14,2,'u',NULL,9,'l');
INSERT INTO `Q` VALUES (NULL,'d','z','j',3,'x','z','w','s',NULL,'v',8,'l','t','i',15,6,'f','j',9,'z');
INSERT INTO `Q` VALUES ('p','z','d','e',3,'h','m','w','j','v','p',9,'s','p','x',16,8,'i','x',4,'b');
INSERT INTO `Q` VALUES (NULL,'d','k','q',4,'j','x',NULL,'j','c','p',1,'r','s','h',17,NULL,'r','b',9,'u');
INSERT INTO `Q` VALUES ('k','n','q','g',6,'d','p','b','g','x','q',8,'b',NULL,'k',18,1,'x','z',9,'k');
INSERT INTO `Q` VALUES ('i','u','a','s',0,NULL,'i','d',NULL,'m',NULL,7,'j','a','p',19,NULL,'q','k',9,'q');
INSERT INTO `Q` VALUES ('s','s','p','f',2,'j','d','p','x','r','b',0,'y','g','u',20,NULL,'f','y',3,'l');
INSERT INTO `Q` VALUES (NULL,'n','h','y',8,'z','k','x','a','y','h',9,'f','w','i',21,7,'r','a',6,'v');
INSERT INTO `Q` VALUES ('h','q','p','r',NULL,NULL,'i',NULL,NULL,'v','w',4,'b','l','s',22,4,'m','f',5,'u');
INSERT INTO `Q` VALUES ('i','n','u','d',NULL,'x','c','z','p','r','k',2,'c','b','h',23,7,'q','h',9,'p');
INSERT INTO `Q` VALUES ('x','x','u','p',0,'s','n',NULL,'t','y','k',2,'n','x','l',24,3,'a','l',4,'k');
INSERT INTO `Q` VALUES ('x','q','g','j',7,NULL,'p','r','q','t','x',6,'f','c','d',25,NULL,'k','m',6,'u');
INSERT INTO `Q` VALUES (NULL,'d','t','o',5,NULL,'p','k','r','u','k',0,'p','j','f',26,7,'m','v',8,'z');
INSERT INTO `Q` VALUES ('u','f','i','u',7,'z','z','a','k','u','r',2,'v','e','m',27,NULL,'u','y',8,'v');
INSERT INTO `Q` VALUES (NULL,'c','e','s',NULL,'n','p',NULL,'d','z','l',0,'w','i','v',28,5,'c','y',3,'m');
INSERT INTO `Q` VALUES ('u','r','f','m',NULL,'f','t','x','r','k',NULL,7,'v','i','g',29,6,'o','a',7,'u');
INSERT INTO `Q` VALUES ('n','z','w','k',1,'i','l','r','r','k','j',4,'l','i','z',30,4,'b','a',0,'c');
INSERT INTO `Q` VALUES ('w','b','d','o',1,'f','m','w','l','f','f',8,'b','m','j',31,9,'c',NULL,4,'w');
INSERT INTO `Q` VALUES ('a','m','o','s',NULL,'p','a','x',NULL,'v','r',5,'m','r','a',32,8,'w','y',9,'q');
INSERT INTO `Q` VALUES ('o','v','v','d',1,'z','s','k','l','s','h',3,'u','o','w',33,NULL,'x','f',0,'j');
INSERT INTO `Q` VALUES ('x','v','y','r',4,'u','g','r','j','k','l',3,'x','x','u',34,NULL,'f','m',1,'e');
INSERT INTO `Q` VALUES ('f','y','f','a',1,NULL,'w','w',NULL,'e','t',4,'i',NULL,'b',35,NULL,'f','p',0,'n');
INSERT INTO `Q` VALUES (NULL,'x','q','y',6,'o','y','q','s','u','y',6,'g','p','c',36,5,'b','z',8,'n');
INSERT INTO `Q` VALUES ('o','c','x','g',2,'a','p','s','t','d','a',6,'y','p','y',37,2,'z','n',8,'m');
INSERT INTO `Q` VALUES ('g','p','n','q',2,'p','b','k',NULL,'u',NULL,5,'o','g','h',38,8,'l',NULL,1,'y');
INSERT INTO `Q` VALUES ('m','y','o','l',4,'e','i','n','z',NULL,'r',1,'r',NULL,'x',39,0,'e',NULL,7,'q');
INSERT INTO `Q` VALUES (NULL,'h','m','e',8,'n','l',NULL,'j','q',NULL,2,'w',NULL,'t',40,2,'f','w',2,'d');
INSERT INTO `Q` VALUES ('u','q','p','c',8,NULL,'l','w',NULL,'t','o',2,'v',NULL,'s',41,9,'n',NULL,6,'d');
INSERT INTO `Q` VALUES ('v','q','b','f',6,NULL,'c',NULL,'p',NULL,'i',5,'v','y','u',42,9,'x','l',7,'b');
INSERT INTO `Q` VALUES ('f','d','h','o',8,'g','j','x','h','g','s',7,'l','o','o',43,NULL,'d','n',2,'s');
INSERT INTO `Q` VALUES ('j','u','h','j',1,'k','q','b','y',NULL,'z',5,'i','o','t',44,8,'h','h',7,'d');
INSERT INTO `Q` VALUES ('l','u','j','v',1,'x','s','q','z','y',NULL,3,'x','e','p',45,NULL,'u','b',1,'e');
INSERT INTO `Q` VALUES (NULL,'y','s','x',NULL,'o','a','e','z','c',NULL,3,'g','y','e',46,9,'q','o',9,'i');
INSERT INTO `Q` VALUES (NULL,'x','l','r',6,'x','i','g','z','r','b',0,'m','c','e',47,2,'s',NULL,7,'p');
INSERT INTO `Q` VALUES (NULL,'w','a','e',NULL,'o','r','m','k',NULL,'h',5,'j','h','l',48,7,'u','q',7,'h');
INSERT INTO `Q` VALUES ('t','b','s','t',7,'e','g','f','k','m','p',4,'o','i','z',49,8,'o',NULL,1,'g');
INSERT INTO `Q` VALUES (NULL,'d','b','y',0,'y','b','k',NULL,'y','s',3,'f','o','q',50,1,'b','m',2,'f');
INSERT INTO `Q` VALUES ('e','g','l','y',1,'o','u',NULL,'s',NULL,'l',4,'l',NULL,'y',51,NULL,'s',NULL,5,'h');
INSERT INTO `Q` VALUES ('j','v','i','i',0,'b','z',NULL,'p','y','q',1,'s','s','z',52,NULL,'t','b',2,'z');
INSERT INTO `Q` VALUES ('e','l','u','a',5,'l','g','z','t',NULL,'k',6,'c',NULL,'f',53,6,'w','v',9,'l');
INSERT INTO `Q` VALUES ('h','i','z','v',NULL,'m','n','n','p','k','d',6,'c','j','g',54,4,'p','t',7,'u');
INSERT INTO `Q` VALUES (NULL,'w','h','e',4,'p','t','r','p',NULL,'a',0,'e','j','a',55,9,'d','r',9,'i');
INSERT INTO `Q` VALUES ('a','t','f','f',3,'j','p',NULL,NULL,'z','w',3,'e','v','p',56,NULL,'r',NULL,2,'h');
INSERT INTO `Q` VALUES ('i','o','c','a',1,'w','o','f','u','m','j',0,'v','f','m',57,6,'d','o',1,'o');
INSERT INTO `Q` VALUES ('d','g','f','z',6,'q','g','x','t',NULL,'i',5,'c','x','n',58,3,'s','x',4,'b');
INSERT INTO `Q` VALUES ('s','l','b','y',6,'x','z','e','g','a','l',1,'x','f','s',59,3,'o','u',4,'y');
INSERT INTO `Q` VALUES (NULL,'m','m','t',6,'w','v','x','x',NULL,'p',9,'g','u','m',60,5,'v','c',6,'o');
INSERT INTO `Q` VALUES (NULL,'p','z','f',0,'c','c','k','h',NULL,'d',3,'y','m','e',61,1,'u','m',0,'j');
INSERT INTO `Q` VALUES (NULL,'p','p','g',4,'k','l','r','t','c','p',9,'h',NULL,'x',62,9,'z',NULL,3,'o');
INSERT INTO `Q` VALUES ('l','d','m','v',NULL,'v','k','b','h',NULL,'g',6,'p',NULL,'a',63,9,'t','g',9,'m');
INSERT INTO `Q` VALUES ('a','i','j','a',1,'l','h','p',NULL,'m','m',0,'z','q','e',64,3,'w','o',8,'a');
INSERT INTO `Q` VALUES ('z','u','c','p',9,NULL,'c','d','g','v','h',5,'w','m','r',65,NULL,'e','r',2,'x');
INSERT INTO `Q` VALUES ('a','j','a','a',NULL,'o','q','z','s',NULL,NULL,8,'c','d','z',66,3,'k','v',4,'k');
INSERT INTO `Q` VALUES ('e','i','u','m',7,'n','r',NULL,'f',NULL,'q',9,'m',NULL,'m',67,1,'a','g',9,'l');
INSERT INTO `Q` VALUES ('w','y','a','n',NULL,'d','v',NULL,'t','t','j',2,'u','l','b',68,0,'z','t',0,'t');
INSERT INTO `Q` VALUES ('p','s','v','z',3,'f','u','d','b','h','m',4,'c',NULL,'f',69,8,'c','l',8,'j');
INSERT INTO `Q` VALUES ('a','k','i','n',1,'l','i','n','l','p','t',7,'h','s','g',70,7,'q',NULL,6,'d');
INSERT INTO `Q` VALUES (NULL,'t','q','r',6,'c','n','r','v','z','z',5,'x','e','j',71,1,'s','l',3,'h');
INSERT INTO `Q` VALUES (NULL,'p','x','h',2,'u','r','l','m','q',NULL,1,'v',NULL,'m',72,9,'o','q',3,'o');
INSERT INTO `Q` VALUES ('z','z','z','t',NULL,NULL,'p','t','n','z','g',2,'y','i','b',73,1,'r','c',5,'w');
INSERT INTO `Q` VALUES ('f','o','x','p',3,'v','b','s','b','n','g',4,'u','n','n',74,0,'u','j',4,'u');
INSERT INTO `Q` VALUES ('j','z','x','k',0,'k','k','g','q',NULL,'j',8,'e','w','j',75,5,'s','q',3,'b');
INSERT INTO `Q` VALUES ('i','e','f','o',6,'t','o','s','p','c','j',7,'z','x','u',76,3,'o',NULL,1,'k');
INSERT INTO `Q` VALUES ('l','s','j','o',8,'i','q','v','y','j','f',0,'t','m','e',77,6,'a','t',2,'l');
INSERT INTO `Q` VALUES (NULL,'q','s','r',3,'w','s','v','r',NULL,'j',8,'i','z','k',78,2,'r','x',9,'r');
INSERT INTO `Q` VALUES ('i','i','z','j',3,'u','s','k','b','m','o',1,'d',NULL,'x',79,4,'r','o',8,'v');
INSERT INTO `Q` VALUES ('u','b','g','t',9,'z','e','z','k','h','j',9,'g','k','f',80,3,'f','u',4,'s');
INSERT INTO `Q` VALUES ('w','f','d','p',1,'v','t',NULL,'e','f','x',6,'p',NULL,'v',81,NULL,'e','y',0,'n');
INSERT INTO `Q` VALUES (NULL,'u','x','z',6,NULL,'q','l',NULL,'m',NULL,2,'j','y','z',82,6,'b','w',8,'w');
INSERT INTO `Q` VALUES ('w','r','q','h',0,'k','n','a',NULL,'a','k',4,'l','x','f',83,6,'r','e',1,'s');
INSERT INTO `Q` VALUES ('d','p','i','x',NULL,'j','r','v','s','o',NULL,6,'b','p','v',84,0,'l','w',1,'n');
INSERT INTO `Q` VALUES (NULL,'w','v','d',1,NULL,'i','o','a','x','p',4,'d','i','c',85,NULL,'z','n',9,'j');
INSERT INTO `Q` VALUES ('w','n','r','i',7,'e','a',NULL,'f','m','z',0,'b','w','t',86,NULL,'f','b',8,'n');
INSERT INTO `Q` VALUES ('a','d','g','a',9,NULL,'d',NULL,NULL,NULL,'w',6,'e','u','o',87,0,'t','a',0,'m');
INSERT INTO `Q` VALUES (NULL,'e','y','d',4,'e','n','t','h','x','q',3,'f','s','f',88,2,'w','h',7,'i');
INSERT INTO `Q` VALUES ('u','u','w','f',7,NULL,'f','a','g','a','z',0,'t',NULL,'x',89,8,'t','p',4,'k');
INSERT INTO `Q` VALUES ('q','c','x','h',6,NULL,'i',NULL,'x','n','r',2,'b','f','t',90,2,'h','y',5,'x');
INSERT INTO `Q` VALUES (NULL,'b','r','q',3,'d','z',NULL,'m','w','l',9,'c','r','x',91,NULL,'f','u',3,'g');
INSERT INTO `Q` VALUES ('x','j','h','a',8,'t','f','i','y','r','e',2,'p','i','q',92,NULL,'w','q',6,'q');
INSERT INTO `Q` VALUES ('t','b','u','c',7,'q','t',NULL,'k','v','u',5,'g',NULL,'g',93,1,'o','s',1,'c');
INSERT INTO `Q` VALUES ('u','j','f','l',NULL,'t','w','p','b',NULL,'n',8,'l','k','d',94,NULL,'p',NULL,3,'x');
INSERT INTO `Q` VALUES ('v','k','r','m',2,NULL,'u','l','k','j',NULL,9,'s','j','h',95,NULL,'x',NULL,4,'s');
INSERT INTO `Q` VALUES ('o','d','k','g',7,NULL,'t','y','l','u','z',2,'q',NULL,'o',96,3,'j',NULL,5,'v');
INSERT INTO `Q` VALUES (NULL,'u','a','t',5,'x','s','d','s','f','y',2,'w',NULL,'a',97,NULL,'j','z',7,'u');
INSERT INTO `Q` VALUES ('c','q','g','y',0,'w','z','v',NULL,NULL,'f',8,'b','c','s',98,9,'q','i',5,'q');
INSERT INTO `Q` VALUES ('h','y','d','t',5,NULL,'p','h',NULL,'v','b',2,'p','i','p',99,6,'t','a',1,'u');
INSERT INTO `Q` VALUES (NULL,'l','l','p',7,'i','i',NULL,NULL,'u','m',3,'o','s','x',100,7,'a','z',0,'g');


CREATE TABLE `H` ( 
  `col_varchar_10_utf8` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, 
  `col_int_key` int(11) DEFAULT NULL, 
  `col_varchar_10_utf8_not_null` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 
  `col_varchar_10_latin1` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 
  `col_varchar_1024_latin1_not_null_key` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, 
  `col_int` int(11) DEFAULT NULL, 
  `col_varchar_1024_latin1_key` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 
  `col_varchar_1024_utf8_key` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, 
  `col_varchar_1024_latin1_not_null` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, 
  `col_varchar_1024_utf8_not_null_key` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 
  `col_varchar_1024_utf8` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, 
  `col_varchar_10_utf8_key` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL, 
  `col_int_not_null_key` int(11) NOT NULL, 
  `col_varchar_10_utf8_not_null_key` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 
  `col_varchar_10_latin1_not_null_key` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, 
  `col_varchar_10_latin1_not_null` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, 
  `pk` int(11) NOT NULL AUTO_INCREMENT,
  `col_int_not_null` int(11) NOT NULL, 
  `col_varchar_10_latin1_key` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 
  `col_varchar_1024_utf8_not_null` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 
  `col_varchar_1024_latin1` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 
  PRIMARY KEY (`pk`),
  KEY `col_int_key` (`col_int_key`),
  KEY `col_varchar_1024_latin1_not_null_key` (`col_varchar_1024_latin1_not_null_key`),
  KEY `col_varchar_1024_latin1_key` (`col_varchar_1024_latin1_key`),
  KEY `col_varchar_1024_utf8_key` (`col_varchar_1024_utf8_key`),
  KEY `col_varchar_1024_utf8_not_null_key` (`col_varchar_1024_utf8_not_null_key`),
  KEY `col_varchar_10_utf8_key` (`col_varchar_10_utf8_key`),
  KEY `col_int_not_null_key` (`col_int_not_null_key`),
  KEY `col_varchar_10_utf8_not_null_key` (`col_varchar_10_utf8_not_null_key`),
  KEY `col_varchar_10_latin1_not_null_key` (`col_varchar_10_latin1_not_null_key`),
  KEY `col_varchar_10_latin1_key` (`col_varchar_10_latin1_key`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

LOCK TABLES `H` WRITE;
/*!40000 ALTER TABLE `H` DISABLE KEYS */;
INSERT INTO `H` VALUES ('q',4,'x','g','h',9,'x','b','s','y','g','y',3,'v','j','y',1,9,'h','j','h');
INSERT INTO `H` VALUES ('t',1,'t','j','t',NULL,'m','l','d','h','m','d',7,'n','q','b',2,7,'t','k','t');
INSERT INTO `H` VALUES ('p',2,'h','r','b',5,'q','l','a','a',NULL,'i',2,'a','g','l',3,3,'g','h','v');
INSERT INTO `H` VALUES (NULL,9,'d','j','p',6,'m','h','h','q','n','e',9,'a','t','h',4,6,'t','d',NULL);
INSERT INTO `H` VALUES ('u',3,'t','s','q',8,'c','w','h','t',NULL,'q',9,'a','q','h',5,8,'y','j','g');
SELECT    table2 . `pk` AS field1 FROM  H AS table1  RIGHT  JOIN Q AS table2 ON  table1 . `col_varchar_10_utf8_key` =  table2 . `col_varchar_1024_latin1_key`  WHERE table1 . `pk` = table2 . `col_int_key`  GROUP BY field1  ORDER BY field1   ;

or

SELECT /*+ INL_JOIN(table2)*/   table2 . `pk` AS field1 FROM  H AS table1  RIGHT  JOIN Q AS table2 ON  table1 . `col_varchar_10_utf8_key` =  table2 . `col_varchar_1024_latin1_key`  WHERE table1 . `pk` = table2 . `col_int_key` order by field1  ;
  1. What did you expect to see?
    Using hash joins returns correct results.
+--------+
| field1 |
+--------+
|      8 |
|     10 |
|     76 |
+--------+
  1. What did you see instead?
+--------+
| field1 |
+--------+
|     12 |
|      8 |
|     10 |
+--------+
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
+----------------------------------------------+
| version()                                    |
+----------------------------------------------+
| 5.7.25-TiDB-v4.0.0-beta-379-ga999ef698-dirty |
+----------------------------------------------+
@fzhedu fzhedu added type/bug The issue is confirmed as a bug. sig/execution SIG execution labels Mar 11, 2020
@fzhedu fzhedu changed the title executor: indexMergeJoin error executor: indexJoin error Mar 20, 2020
@fzhedu fzhedu changed the title executor: indexJoin error executor: indexJoin error resulted from copy after inline projection Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants