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

The index join on columns of year type and int type gets wrong result #23501

Closed
lilinghai opened this issue Mar 24, 2021 · 1 comment
Closed
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug. type/stale This issue has not been updated for a long time.

Comments

@lilinghai
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t1(a int,key(a));
create table t2(a year,key(a));
insert into t1 values(-1);
insert into t2 values(null);
select /*+ hash_join (t1,t2) */ * FROM t1 left outer join t2 on t1.a=t2.a; -- successfully
select /*+ inl_join (t1,t2) */ * FROM t1 left outer join t2 on t1.a=t2.a; -- ERROR 8033 (HY000): invalid year

2. What did you expect to see? (Required)

+------+------+
| a    | a    |
+------+------+
|   -1 | NULL |
+------+------+

3. What did you see instead (Required)

ERROR 8033 (HY000): invalid year

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-2431-gd1cc4c6a9
Edition: Community
Git Commit Hash: d1cc4c6
Git Branch: master
UTC Build Time: 2021-03-23 07:48:20
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@lilinghai lilinghai added the type/bug The issue is confirmed as a bug. label Mar 24, 2021
@jebter
Copy link

jebter commented Jun 24, 2024

MySQL [email protected]:db1> drop table if exists t1,t2;
You're about to run a destructive command.
Do you want to proceed? (y/n): y
Your call!
Query OK, 0 rows affected
Time: 0.845s
MySQL [email protected]:db1> create table t1(a int,key(a));
Query OK, 0 rows affected
Time: 0.146s
MySQL [email protected]:db1> create table t2(a year,key(a));
Query OK, 0 rows affected
Time: 0.166s
MySQL [email protected]:db1> insert into t1 values(-1);
Query OK, 1 row affected
Time: 0.005s
MySQL [email protected]:db1> insert into t2 values(null);
Query OK, 1 row affected
Time: 0.006s
MySQL [email protected]:db1> select /*+ hash_join (t1,t2) */ * FROM t1 left outer join t2 on t1.a=t2.a; -- successfully
+----+--------+
| a  | a      |
+----+--------+
| -1 | <null> |
+----+--------+
1 row in set
Time: 0.009s
MySQL [email protected]:db1> select /*+ inl_join (t1,t2) */ * FROM t1 left outer join t2 on t1.a=t2.a;
+----+--------+
| a  | a      |
+----+--------+
| -1 | <null> |
+----+--------+
1 row in set
Time: 0.009s

Please try the latest version. If there are any updates, you can reopen it.

@jebter jebter closed this as completed Jun 24, 2024
@jebter jebter added the type/stale This issue has not been updated for a long time. label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug. type/stale This issue has not been updated for a long time.
Projects
None yet
Development

No branches or pull requests

3 participants