unexpected other error using hash join
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
``` SQL
CREATE TABLE `t69724e20` (
`col_19` date NOT NULL,
PRIMARY KEY (`col_19`) /*T![clustered_index] CLUSTERED */,
KEY `idx_6` (`col_19`),
UNIQUE KEY `idx_7` (`col_19`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `t69724e20` VALUES('1972-04-13'),('1973-07-16'),('1975-11-22'),('1987-02-25'),('1989-09-11'),('1989-12-23'),('1991-04-15'),('1994-05-01'),('1995-03-05'),('2003-02-04'),('2008-09-08'),('2011-08-06'),('2016-02-04'),('2016-02-07'),('2018-01-27'),('2023-07-29'),('2024-11-05'),('2025-11-17'),('2028-08-04'),('2030-01-27'),('2030-03-06');
select * FROM `t69724e20` JOIN (SELECT COUNT(DISTINCT `t69724e20`.`col_19`) AS `r0`,SUBSTR(`t69724e20`.`col_19`, 3) AS `r1`,CHARACTER_LENGTH(`t69724e20`.`col_19`) AS `r2`,`t69724e20`.`col_19` AS `r3`,BIT_XOR(`t69724e20`.`col_19`) AS `r4` FROM `t69724e20` GROUP BY `t69724e20`.`col_19` ORDER BY `r0`,`r1`,`r2`,`r3`,`r4`) AS `st_518` ON `t69724e20`.`col_19`=`st_518`.`r4` WHERE NOT (`st_518`.`r0`=5103557308169336446) AND `t69724e20`.`col_19` IN ('2016-02-07');
```
### 2. What did you expect to see? (Required)
one row
Refer to
``` SQL
mysql> SELECT SUM((NOT (`st_518`.`r0`=5103557308169336446) AND `t69724e20`.`col_19` IN ('2016-02-07')) IS TRUE) FROM `t69724e20` JOIN (SELECT /*+ USE_INDEX_MERGE(`t69724e20` )*/ COUNT(DISTINCT `t69724e20`.`col_19`) AS `r0`,SUBSTR(`t69724e20`.`col_19`, 3) AS `r1`,CHARACTER_LENGTH(`t69724e20`.`col_19`) AS `r2`,`t69724e20`.`col_19` AS `r3`,BIT_XOR(`t69724e20`.`col_19`) AS `r4` FROM `t69724e20` GROUP BY `t69724e20`.`col_19` ORDER BY `r0`,`r1`,`r2`,`r3`,`r4`) AS `st_518` ON `t69724e20`.`col_19`=`st_518`.`r4`;
+---------------------------------------------------------------------------------------------------+
| SUM((NOT (`st_518`.`r0`=5103557308169336446) AND `t69724e20`.`col_19` IN ('2016-02-07')) IS TRUE) |
+---------------------------------------------------------------------------------------------------+
| 1 |
+---------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.02 sec)
```
### 3. What did you see instead (Required)
``` SQL
mysql> select * FROM `t69724e20` JOIN (SELECT COUNT(DISTINCT `t69724e20`.`col_19`) AS `r0`,SUBSTR(`t69724e20`.`col_19`, 3) AS `r1`,CHARACTER_LENGTH(`t69724e20`.`col_19`) AS `r2`,`t69724e20`.`col_19` AS `r3`,BIT_XOR(`t69724e20`.`col_19`) AS `r4` FROM `t69724e20` GROUP BY `t69724e20`.`col_19` ORDER BY `r0`,`r1`,`r2`,`r3`,`r4`) AS `st_518` ON `t69724e20`.`col_19`=`st_518`.`r4` WHERE NOT (`st_518`.`r0`=5103557308169336446) AND `t69724e20`.`col_19` IN ('2016-02-07');
Empty set (0.01 sec)
```
### 4. What is your TiDB version? (Required)
671534a755e5ac3fbb5b515cc15f4d54142e6810
Contributor guide
Assessment
This issue has not been assessed yet.