query gets the incorrect result when compares bit and int during 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 `taae86be0` (
`col_60` bit(5) NOT NULL DEFAULT b'10101',
PRIMARY KEY (`col_60`) /*T![clustered_index] CLUSTERED */,
UNIQUE KEY `idx_25` (`col_60`),
UNIQUE KEY `idx_26` (`col_60`),
KEY `idx_27` (`col_60`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `taae86be0` VALUES (0x03);
CREATE TABLE `tl630985f6` (
`col_1` year(4) NOT NULL,
`col_2` datetime NOT NULL DEFAULT '1999-05-01 00:00:00',
`col_3` binary(111) NOT NULL,
`col_4` mediumint(8) unsigned NOT NULL,
`col_5` json DEFAULT NULL,
`col_6` varchar(162) COLLATE utf8_general_ci DEFAULT NULL,
`col_33` char(169) CHARACTER SET gbk COLLATE gbk_bin DEFAULT 'y',
UNIQUE KEY `idx_1` (`col_4`,(cast(`col_5` as binary(64) array))),
PRIMARY KEY (`col_4`,`col_3`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tl630985f6` VALUES ('1994','2026-02-02 00:00:00',x'24395e616c684025584a294561644a352a71000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,'\"vWf WzdjxWtFsOB5ocCt23\"','U','cP嗜44S'), ('1994','1975-01-18 00:00:00',x'290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,'\"HeiPgl3lrsV1f1otsAjlGRQlHsIyfnPwj1yV\"','(XBKl','嫧hi4B珄忴'), ('1994','2031-05-27 00:00:00',x'2d4d24317664266b53000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,'\" knWZznceoF QWdUW\"','evT(A)s=vs7iGoCc','cP嗜44S'), ('1994','1993-11-18 00:00:00',x'406900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,NULL,'q%0y==uG0ULu','AD+SVl%G7Bama'), ('1994','1972-07-22 00:00:00',x'513d245128404c7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,'\"d1Oyc7sgZi4rhRFheKTBs4ltrjo3omEBEoowrEnVTWhfFkSkBlu\"','VvPlmc%W35)','k**o柪_KRl=-K3躱-@-'), ('1994','1976-07-04 00:00:00',x'6c23734f3038246b4163267e6e3933000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,'\"C0XljJgL7761was5TjV IDynluqM66lViMTewlmSDU8NTK\"','evT(A)s=vs7iGoCc','6_2r类LU'), ('1994','2007-12-04 00:00:00',x'71465050686129794e296723770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',4896157,NULL,'oXVe#Q(9_Ln6!53a(','酻$n喠');
select taae86be0.col_60 in (3) from tl630985f6 right join taae86be0 on tl630985f6.col_1 = taae86be0.col_60 where taae86be0.col_60 in (3);
```
### 2. What did you expect to see? (Required)
MySQL:
``` SQL
mysql> select taae86be0.col_60 in (3) from tl630985f6 right join taae86be0 on tl630985f6.col_1 = taae86be0.col_60 where taae86be0.col_60 in (3);
+-------------------------+
| taae86be0.col_60 in (3) |
+-------------------------+
| 1 |
+-------------------------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
``` SQL
mysql> select taae86be0.col_60 in (3) from tl630985f6 right join taae86be0 on tl630985f6.col_1 = taae86be0.col_60 where taae86be0.col_60 in (3);
Empty set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
nightly-323b0f772b44057fab856847ce3c0a19834483ec
Contributor guide
Assessment
This issue has not been assessed yet.