Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
use test;
drop table if exists IDT_HP24172;
CREATE TABLE `IDT_HP24172` (
`COL1` mediumint(16) DEFAULT NULL,
`COL2` varchar(20) DEFAULT NULL,
`COL4` datetime DEFAULT NULL,
`COL3` bigint(20) DEFAULT NULL,
`COL5` float DEFAULT NULL,
KEY `UM_COL` (`COL1`,`COL3`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY HASH( `COL1`+`COL3` )
PARTITIONS 8;
insert into IDT_HP24172(col1) values(8388607);
select col2 from IDT_HP24172 where col1 = 8388607 and col1 in (select col1 from IDT_HP24172);
2. What did you expect to see? (Required)
mysql> select col2 from IDT_HP24172 where col1 = 8388607 and col1 in (select col1 from IDT_HP24172);
+------+
| col2 |
+------+
| NULL |
+------+
1 row in set (0.01 sec)
3. What did you see instead (Required)
mysql> select col2 from IDT_HP24172 where col1 = 8388607 and col1 in (select col1 from IDT_HP24172);
ERROR 1105 (HY000): Internal error: UnionExec chunk column count mismatch, req: 2, result: 1
4. What is your TiDB version? (Required)
It can be reproduced on branch release-5.0, release-5.1 and master
The release-4.0 branch doesn't have the issue
Release Version: v5.1.0-64-gfb0eaf7b4
Edition: Community
Git Commit Hash: fb0eaf7b44b9ddb1494bf8194d8e361c538146dc
Git Branch: release-5.1
UTC Build Time: 2021-07-26 06:50:38
GoVersion: go1.16.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
It can be reproduced on branch release-5.0, release-5.1 and master
The release-4.0 branch doesn't have the issue