-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Panic triggered at expression.ExplainExpressionList (planner/core/explain.go:335) #42587
Comments
I tested it locally, it has been fixed since v7.2.0. |
This issue was accidentally fixed by #44164. So we still encounter the same issue after disabling I'm not sure if it's worth fixing because we enabled it since v7.2.0. I will discuss it with the team this week. |
The panic happened here: tidb/pkg/expression/explain.go Line 176 in 79c1499
|
The stack looks like this:
|
create database testdb;
use testdb;
DROP TABLE IF EXISTS `t0`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `t0`
(
`vkey` int(11) DEFAULT NULL,
`pkey` int(11) DEFAULT NULL,
`c0` int(11) DEFAULT NULL,
`c1` double DEFAULT NULL,
`c2` varchar(100) DEFAULT NULL,
`c3` double DEFAULT NULL,
`c4` double DEFAULT NULL,
`c5` int(11) DEFAULT NULL,
`c6` double NOT NULL,
`c7` int(11) DEFAULT NULL,
`c8` int(11) DEFAULT NULL,
PRIMARY KEY (`c6`) /*T![clustered_index] CLUSTERED */
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t0`
--
LOCK TABLES `t0` WRITE;
/*!40000 ALTER TABLE `t0`
DISABLE KEYS */;
INSERT INTO `t0`
VALUES (1, 14000, NULL, -72.99, NULL, -64.2, 0, NULL, -97.54, NULL, NULL),
(1, 13000, NULL, 0, NULL, 0, -33.89, NULL, -67.19, NULL, NULL),
(1, 16000, NULL, -66.4, NULL, 8.71, 32.95, NULL, 0, NULL, NULL),
(1, 17000, NULL, -10.88, NULL, 0, 0, NULL, 19.29, NULL, NULL),
(1, 11000, NULL, 0.2, NULL, -96.9, 44.59, NULL, 20.8, NULL, NULL),
(1, 12000, NULL, 95.15, NULL, 10.54, 69.22, NULL, 46.1, NULL, NULL),
(1, 15000, NULL, -94.76, NULL, 0, -38.8, NULL, 73.7, NULL, NULL);
/*!40000 ALTER TABLE `t0`
ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t1`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `t1`
(
`vkey` int(11) DEFAULT NULL,
`pkey` int(11) DEFAULT NULL,
`c9` int(11) DEFAULT NULL,
`c10` varchar(100) DEFAULT NULL,
`c11` varchar(100) DEFAULT NULL,
`c12` double DEFAULT NULL,
`c13` int(11) DEFAULT NULL,
`c14` int(11) DEFAULT NULL,
`c15` int(11) DEFAULT NULL,
`c16` double DEFAULT NULL,
`c17` varchar(100) DEFAULT NULL,
KEY `i2` (`pkey`, `c12`, `vkey`, `c16`, `c17`, `c11`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin /*T! SHARD_ROW_ID_BITS=6 */;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t1`
--
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1`
DISABLE KEYS */;
INSERT INTO `t1`
VALUES (45, 260000, NULL, NULL, NULL, 27.43, NULL, NULL, NULL, 83.24, NULL),
(45, 261000, NULL, NULL, NULL, 86.63, NULL, NULL, NULL, 56.53, NULL),
(45, 262000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL),
(45, 263000, NULL, NULL, NULL, -48.34, NULL, NULL, NULL, 6.75, NULL),
(45, 264000, NULL, NULL, NULL, -27.91, NULL, NULL, NULL, -80.16, NULL),
(45, 265000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -17.94, NULL),
(45, 266000, NULL, NULL, NULL, -96.49, NULL, NULL, NULL, 0, NULL),
(45, 267000, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL),
(23, 138000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -47.93, NULL),
(23, 139000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -3.76, NULL),
(23, 140000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -19.52, NULL),
(23, 141000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -12.96, NULL),
(23, 142000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 25.62, NULL),
(23, 143000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -8.36, NULL),
(23, 144000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL),
(30, 181000, NULL, NULL, NULL, -10.45, NULL, NULL, NULL, NULL, NULL),
(30, 182000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -25.26, NULL),
(30, 183000, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL),
(30, 184000, NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL),
(30, 185000, NULL, NULL, NULL, -55.77, NULL, NULL, NULL, 0, NULL),
(30, 186000, NULL, NULL, NULL, 44.47, NULL, NULL, NULL, NULL, NULL),
(30, 187000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 30.58, NULL),
(30, 188000, NULL, NULL, NULL, -80.47, NULL, NULL, NULL, 0, NULL),
(46, 268000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(46, 269000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL),
(46, 270000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(46, 271000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL),
(46, 272000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 20.63, NULL),
(25, 152000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 76.89, NULL),
(25, 153000, NULL, NULL, NULL, -55.37, NULL, NULL, NULL, 72.44, NULL),
(25, 154000, NULL, NULL, NULL, 57.46, NULL, NULL, NULL, -45.47, NULL),
(25, 155000, NULL, NULL, NULL, 0, NULL, NULL, NULL, 14.51, NULL),
(25, 156000, NULL, NULL, NULL, 26.15, NULL, NULL, NULL, NULL, NULL),
(25, 157000, NULL, NULL, NULL, 52.79, NULL, NULL, NULL, 53.35, NULL),
(25, 158000, NULL, NULL, NULL, 41.61, NULL, NULL, NULL, -94.89, NULL),
(8, 50000, NULL, NULL, NULL, 57.29, NULL, NULL, NULL, 36.4, NULL),
(8, 51000, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL),
(8, 52000, NULL, NULL, NULL, 94.74, NULL, NULL, NULL, -5.47, NULL),
(8, 53000, NULL, NULL, NULL, 0, NULL, NULL, NULL, 4.15, NULL),
(8, 54000, NULL, NULL, NULL, 25.7, NULL, NULL, NULL, 0, NULL),
(27, 167000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL),
(27, 168000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -18.84, NULL),
(27, 169000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 85.13, NULL),
(27, 170000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL),
(27, 171000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -63.63, NULL);
/*!40000 ALTER TABLE `t1`
ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t2`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `t2`
(
`vkey` int(11) NOT NULL,
`pkey` int(11) DEFAULT NULL,
`c18` int(11) DEFAULT NULL,
PRIMARY KEY (`vkey`) /*T![clustered_index] CLUSTERED */,
KEY `i0` (`pkey`, `vkey`, `c18`),
KEY `i1` (`vkey`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t2`
--
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2`
DISABLE KEYS */;
/*!40000 ALTER TABLE `t2`
ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t3`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `t3`
(
`vkey` int(11) DEFAULT NULL,
`pkey` int(11) DEFAULT NULL,
`c19` double DEFAULT NULL,
`c20` varchar(100) DEFAULT NULL,
`c21` double DEFAULT NULL,
`c22` double DEFAULT NULL,
`c23` int(11) DEFAULT NULL,
`c24` int(11) NOT NULL,
`c25` int(11) DEFAULT NULL,
`c26` double DEFAULT NULL,
`c27` int(11) DEFAULT NULL,
PRIMARY KEY (`c24`) /*T![clustered_index] CLUSTERED */
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t3`
--
LOCK TABLES `t3` WRITE;
/*!40000 ALTER TABLE `t3`
DISABLE KEYS */;
/*!40000 ALTER TABLE `t3`
ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t5`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `t5`
(
`vkey` int(11) DEFAULT NULL,
`pkey` int(11) DEFAULT NULL,
`c37` double DEFAULT NULL,
`c38` double DEFAULT NULL,
`c39` varchar(100) DEFAULT NULL,
`c40` int(11) DEFAULT NULL,
`c41` double DEFAULT NULL,
`c42` int(11) DEFAULT NULL
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t5`
--
LOCK TABLES `t5` WRITE;
/*!40000 ALTER TABLE `t5`
DISABLE KEYS */;
INSERT INTO `t5`
VALUES (2, 18000, NULL, 0, NULL, NULL, NULL, NULL),
(2, 19000, NULL, NULL, NULL, NULL, -94.3, NULL),
(2, 20000, NULL, 20.85, NULL, NULL, -8.18, NULL),
(2, 21000, NULL, 0, NULL, NULL, 78.83, NULL),
(2, 22000, NULL, -48.62, NULL, NULL, 0, NULL),
(2, 23000, NULL, 0, NULL, NULL, 6.2, NULL),
(2, 24000, NULL, -68.57, NULL, NULL, 0, NULL),
(2, 25000, NULL, -12.27, NULL, NULL, 0, NULL),
(3, 26000, -85.36, 0, NULL, NULL, 0, NULL),
(3, 27000, 0, 0, NULL, NULL, -72.43, NULL),
(3, 28000, NULL, 49.16, NULL, NULL, 0, NULL),
(3, 29000, 10.63, -46.48, NULL, NULL, -17.22, NULL),
(3, 30000, -67.64, 77.61, NULL, NULL, -99.47, NULL),
(10, 63000, NULL, 24.2, NULL, NULL, 21.38, NULL),
(10, 64000, NULL, 83.95, NULL, NULL, 34.4, NULL),
(10, 65000, NULL, -33.25, NULL, NULL, 0, NULL),
(16, 95000, 0, -81.1, NULL, NULL, 0, NULL),
(16, 96000, 3.39, 64.81, NULL, NULL, -18.72, NULL),
(16, 97000, 53.97, 0, NULL, NULL, 93.11, NULL),
(17, 98000, 0, -70.27, NULL, NULL, 2.42, NULL),
(17, 99000, 85.71, -82.64, NULL, NULL, NULL, NULL),
(17, 100000, 47.64, 0, NULL, NULL, 0, NULL),
(17, 101000, 67.3, -58.21, NULL, NULL, 0, NULL),
(21, 122000, 0, NULL, NULL, NULL, 0, NULL),
(21, 123000, 50.69, NULL, NULL, NULL, -89.2, NULL),
(21, 124000, NULL, NULL, NULL, NULL, -93.31, NULL),
(21, 125000, -63.84, NULL, NULL, NULL, -29.7, NULL),
(21, 126000, 16.7, NULL, NULL, NULL, 24.5, NULL),
(21, 127000, -31.89, NULL, NULL, NULL, 0, NULL),
(21, 128000, 2.58, NULL, NULL, NULL, -86.1, NULL),
(21, 129000, 12.76, NULL, NULL, NULL, 0, NULL),
(22, 130000, -81.81, 0, NULL, NULL, -26.29, NULL),
(22, 131000, -29.45, 65.3, NULL, NULL, 0, NULL),
(22, 132000, 8.11, -91.38, NULL, NULL, 94.15, NULL),
(22, 133000, NULL, -17.69, NULL, NULL, -65.74, NULL),
(22, 134000, 0, 0, NULL, NULL, -82.62, NULL),
(22, 135000, -59.5, 28.6, NULL, NULL, -58.52, NULL),
(22, 136000, -85.2, 20.68, NULL, NULL, -2.3, NULL),
(22, 137000, 0, 0, NULL, NULL, 0, NULL),
(26, 159000, 0, 0, NULL, NULL, -5.58, NULL),
(26, 160000, 0, 40.8, NULL, NULL, 0, NULL),
(26, 161000, 38.22, 0, NULL, NULL, NULL, NULL),
(26, 162000, -18.51, 73.59, NULL, NULL, -100.65, NULL),
(26, 163000, 0, 17.54, NULL, NULL, 0, NULL),
(26, 164000, 0, 0, NULL, NULL, 98.45, NULL),
(26, 165000, NULL, 0, NULL, NULL, 0, NULL),
(26, 166000, 0, 0, NULL, NULL, 46.68, NULL),
(32, 196000, 0, NULL, NULL, NULL, 11.16, NULL),
(32, 197000, NULL, NULL, NULL, NULL, 0, NULL),
(32, 198000, -17.67, NULL, NULL, NULL, NULL, NULL),
(32, 199000, 33.25, NULL, NULL, NULL, -66.69, NULL),
(38, 227000, 68.22, 0, NULL, NULL, NULL, NULL),
(38, 228000, 0, 0, NULL, NULL, 56.89, NULL),
(38, 229000, 64.79, -40.61, NULL, NULL, 89.14, NULL),
(38, 230000, NULL, -100.53, NULL, NULL, -40.1, NULL),
(38, 231000, -8.98, -75.9, NULL, NULL, 29.86, NULL),
(44, 256000, 46.98, 0, NULL, NULL, NULL, NULL),
(44, 257000, NULL, -56.3, NULL, NULL, 36.23, NULL),
(44, 258000, -12.39, 74.77, NULL, NULL, 0, NULL),
(44, 259000, 10.45, NULL, NULL, NULL, 46.46, NULL),
(53, 299000, 44.95, 48.49, NULL, NULL, -11.99, NULL),
(53, 300000, 63.5, 13.31, NULL, NULL, 89.21, NULL),
(53, 301000, NULL, 63.13, NULL, NULL, 0, NULL),
(53, 302000, 35.59, 0, NULL, NULL, 0, NULL),
(53, 303000, -5.73, NULL, NULL, NULL, 57.27, NULL),
(53, 304000, -93.48, 78.11, NULL, NULL, 0, NULL),
(53, 305000, -6.29, -66.2, NULL, NULL, 29.15, NULL),
(53, 306000, 0, -36.21, NULL, NULL, 55.47, NULL),
(54, 307000, -53.51, -52.47, NULL, NULL, NULL, NULL),
(54, 308000, -89.13, 0, NULL, NULL, NULL, NULL),
(54, 309000, -70.77, 0, NULL, NULL, NULL, NULL),
(54, 310000, 0, 0, NULL, NULL, NULL, NULL),
(54, 311000, -24.94, 0, NULL, NULL, NULL, NULL),
(54, 312000, 37.1, 0, NULL, NULL, NULL, NULL),
(56, 321000, 0, NULL, NULL, NULL, 0, NULL),
(56, 322000, 26.7, 30.43, NULL, NULL, 5.72, NULL),
(56, 323000, -32.36, 30.27, NULL, NULL, 13.52, NULL),
(56, 324000, 61.62, -77.96, NULL, NULL, 0, NULL),
(56, 325000, NULL, -45.95, NULL, NULL, 62.34, NULL),
(56, 326000, 91.67, 71.17, NULL, NULL, 67.7, NULL),
(56, 327000, 0, 0, NULL, NULL, -64.49, NULL),
(56, 328000, 54.24, 0, NULL, NULL, -46.18, NULL);
/*!40000 ALTER TABLE `t5`
ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t6`;
/*!50001 DROP VIEW IF EXISTS `t6`*/;
SET @saved_cs_client = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `t6` AS
SELECT 1 AS `c0`,
1 AS `c1`
*/;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `t6`*/;
/*!50001 CREATE ALGORITHM = UNDEFINED */ /*!50013 DEFINER =`root`@`%` SQL SECURITY DEFINER */ /*!50001 VIEW `t6` (`c0`, `c1`) AS
SELECT `subq_0`.`c1` AS `c0`, NULL AS `c1`
FROM (SELECT (SELECT `c8` AS `c8` FROM `testdb`.`t0` ORDER BY `c8` LIMIT 1,1) AS `c0`, `ref_0`.`pkey` AS `c1`
FROM `testdb`.`t2` AS `ref_0`
WHERE (((`ref_0`.`c18`) >= (SELECT `ref_0`.`vkey` AS `c0`
FROM `testdb`.`t3` AS `ref_1`
WHERE ((`ref_1`.`c26`) != (SELECT `ref_2`.`c37` AS `c0`
FROM `testdb`.`t5` AS `ref_2`
WHERE ((NULL) AND (FALSE))
OR (EXISTS (SELECT `ref_1`.`c26` AS `c0`,
`ref_3`.`c3` AS `c1`,
`ref_3`.`pkey` AS `c2`,
`ref_3`.`vkey` AS `c3`,
`ref_3`.`c6` AS `c4`,
`ref_1`.`c26` AS `c5`,
79 AS `c6`,
NULL AS `c7`,
`ref_3`.`vkey` AS `c8`,
`ref_3`.`c1` AS `c9`,
(SELECT `c17` AS `c17` FROM `testdb`.`t1` ORDER BY `c17` LIMIT 4,1) AS `c10`,
`ref_3`.`c4` AS `c11`,
`ref_3`.`c6` AS `c12`,
`ref_3`.`c6` AS `c13`,
`ref_2`.`c40` AS `c14`,
90 AS `c15`
FROM `testdb`.`t0` AS `ref_3`
WHERE NULL
UNION ALL
SELECT `ref_2`.`c41` AS `c0`,
`ref_2`.`c38` AS `c1`,
`ref_1`.`pkey` AS `c2`,
`ref_0`.`pkey` AS `c3`,
0.0 AS `c4`,
`ref_1`.`c21` AS `c5`,
-20 AS `c6`,
((TRUE) IN
(SELECT (-97) = (-73) AS `c0`
FROM `testdb`.`t2` AS `ref_9`
WHERE NULL)) IS TRUE AS `c7`,
`ref_2`.`pkey` AS `c8`,
`ref_1`.`c26` AS `c9`,
`ref_1`.`c20` AS `c10`,
`ref_2`.`c41` AS `c11`,
`ref_2`.`c41` AS `c12`,
`ref_2`.`c37` AS `c13`,
(SELECT `vkey` AS `vkey` FROM `testdb`.`t2` ORDER BY `vkey` LIMIT 6,1) AS `c14`,
0 AS `c15`
FROM `testdb`.`t2` AS `ref_4`
WHERE (((SELECT `c39` AS `c39` FROM `testdb`.`t5` ORDER BY `c39` LIMIT 1,1)) IN
(SELECT DISTINCT `ref_5`.`c20` AS `c0`
FROM `testdb`.`t3` AS `ref_5`
WHERE (-0) BETWEEN (0) AND (-0)
UNION ALL
SELECT `ref_6`.`c17` AS `c0`
FROM `testdb`.`t1` AS `ref_6`
WHERE (FALSE)
OR ((`ref_6`.`c13`) =
(SELECT `ref_6`.`c13` AS `c0`
FROM `testdb`.`t5` AS `ref_7`
WHERE ((-0) < (0))
AND ((`ref_7`.`c41`) !=
(SELECT DISTINCT `ref_8`.`c21` AS `c0`
FROM `testdb`.`t3` AS `ref_8`
WHERE (NOT ((-22) BETWEEN (-0) AND (-19)))
OR ((82) > (91))
ORDER BY `c0`
LIMIT 1))
ORDER BY `c0`
LIMIT 1)))) IS TRUE))
ORDER BY `c0` DESC
LIMIT 1))
AND ((NULL) OR ((-75) > (42)))
ORDER BY `c0` DESC
LIMIT 1)) AND ((-54) BETWEEN (68) AND (0)))
OR ((`ref_0`.`vkey`) IS NULL)
ORDER BY `c0`, `c1` DESC) AS `subq_0`
WHERE (`subq_0`.`c1`) IS NOT NULL
*/;
set @@tidb_remove_orderby_in_subquery = 0;
explain select ref_39.c17 as c0
from (t1 as ref_39
left outer join t2 as ref_40
on (ref_39.c13 = ref_40.vkey))
where (case
when exists (select ref_73.c9 as c0
from t1 as ref_73
union
select null + 83 as c0
from t6 as ref_77
where (ref_40.pkey = null)
and (2 > (select 1 as c0
from t1 as ref_85
where exists (select ref_103.c25 as c0
from t3 as ref_103
where ref_85.c13 = ref_103.c25)
limit 1))) then null
else 1 end
) >= 1;
|
Tested it with the latest master, and it was fixed by #52836. |
explain
SELECT `subq_0`.`c1` AS `c0`, NULL AS `c1`
FROM (SELECT (SELECT `c8` AS `c8` FROM `testdb`.`t0` ORDER BY `c8` LIMIT 1,1) AS `c0`, `ref_0`.`pkey` AS `c1`
FROM `testdb`.`t2` AS `ref_0`
WHERE (((`ref_0`.`c18`) >= (SELECT `ref_0`.`vkey` AS `c0`
FROM `testdb`.`t3` AS `ref_1`
WHERE ((`ref_1`.`c26`) != (SELECT `ref_2`.`c37` AS `c0`
FROM `testdb`.`t5` AS `ref_2`
WHERE ((NULL) AND (FALSE))
OR (EXISTS (SELECT `ref_1`.`c26` AS `c0`,
`ref_3`.`c3` AS `c1`,
`ref_3`.`pkey` AS `c2`,
`ref_3`.`vkey` AS `c3`,
`ref_3`.`c6` AS `c4`,
`ref_1`.`c26` AS `c5`,
79 AS `c6`,
NULL AS `c7`,
`ref_3`.`vkey` AS `c8`,
`ref_3`.`c1` AS `c9`,
(SELECT `c17` AS `c17` FROM `testdb`.`t1` ORDER BY `c17` LIMIT 4,1) AS `c10`,
`ref_3`.`c4` AS `c11`,
`ref_3`.`c6` AS `c12`,
`ref_3`.`c6` AS `c13`,
`ref_2`.`c40` AS `c14`,
90 AS `c15`
FROM `testdb`.`t0` AS `ref_3`
WHERE NULL
UNION ALL
SELECT `ref_2`.`c41` AS `c0`,
`ref_2`.`c38` AS `c1`,
`ref_1`.`pkey` AS `c2`,
`ref_0`.`pkey` AS `c3`,
0.0 AS `c4`,
`ref_1`.`c21` AS `c5`,
-20 AS `c6`,
((TRUE) IN
(SELECT (-97) = (-73) AS `c0`
FROM `testdb`.`t2` AS `ref_9`
WHERE NULL)) IS TRUE AS `c7`,
`ref_2`.`pkey` AS `c8`,
`ref_1`.`c26` AS `c9`,
`ref_1`.`c20` AS `c10`,
`ref_2`.`c41` AS `c11`,
`ref_2`.`c41` AS `c12`,
`ref_2`.`c37` AS `c13`,
(SELECT `vkey` AS `vkey` FROM `testdb`.`t2` ORDER BY `vkey` LIMIT 6,1) AS `c14`,
0 AS `c15`
FROM `testdb`.`t2` AS `ref_4`
WHERE (((SELECT `c39` AS `c39` FROM `testdb`.`t5` ORDER BY `c39` LIMIT 1,1)) IN
(SELECT DISTINCT `ref_5`.`c20` AS `c0`
FROM `testdb`.`t3` AS `ref_5`
WHERE (-0) BETWEEN (0) AND (-0)
UNION ALL
SELECT `ref_6`.`c17` AS `c0`
FROM `testdb`.`t1` AS `ref_6`
WHERE (FALSE)
OR ((`ref_6`.`c13`) =
(SELECT `ref_6`.`c13` AS `c0`
FROM `testdb`.`t5` AS `ref_7`
WHERE ((-0) < (0))
AND ((`ref_7`.`c41`) !=
(SELECT DISTINCT `ref_8`.`c21` AS `c0`
FROM `testdb`.`t3` AS `ref_8`
WHERE (NOT ((-22) BETWEEN (-0) AND (-19)))
OR ((82) > (91))
ORDER BY `c0`
LIMIT 1))
ORDER BY `c0`
LIMIT 1)))) IS TRUE))
ORDER BY `c0` DESC
LIMIT 1))
AND ((NULL) OR ((-75) > (42)))
ORDER BY `c0` DESC
LIMIT 1)) AND ((-54) BETWEEN (68) AND (0)))
OR ((`ref_0`.`vkey`) IS NULL)
ORDER BY `c0`, `c1` DESC) AS `subq_0`
WHERE (`subq_0`.`c1`) IS NOT NULL;
Before #52836:
After the change:
|
And the query's plan is:
So as you can see, if we reset the children projection's schmea, then we will get a panic. Because we use it in the probe side. |
@hi-rustin can you cherry-pick to 7.5? |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Setup the environment:
mysql_bk.sql: mysql_bk.txt
Testcase
2. What did you expect to see? (Required)
No panic.
3. What did you see instead (Required)
Log of TiDB server:
4. What is your TiDB version? (Required)
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.1.0-alpha-27-gf5ca27ef3
Edition: Community
Git Commit Hash: f5ca27e
Git Branch: master
UTC Build Time: 2023-03-23 13:57:53
GoVersion: go1.20.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
The text was updated successfully, but these errors were encountered: