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

Got incorrect result when using hash join #19112

Closed
zyguan opened this issue Aug 11, 2020 · 0 comments · Fixed by #19131
Closed

Got incorrect result when using hash join #19112

zyguan opened this issue Aug 11, 2020 · 0 comments · Fixed by #19131
Assignees
Labels
severity/critical type/bug The issue is confirmed as a bug.
Milestone

Comments

@zyguan
Copy link
Contributor

zyguan commented Aug 11, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1, t2;
create table t1 ( c_int int, c_decimal decimal(12, 6), key(c_int), unique key(c_decimal) );
create table t2 like t1;
insert into t1 (c_int, c_decimal) values (1, 4.064000), (2, 0.257000), (3, 1.010000);
insert into t2 (c_int, c_decimal) values (1, 4.064000), (3, 1.010000);
select /*+ INL_MERGE_JOIN(t1,t2) */  * from t1 join t2 on t1.c_decimal = t2.c_decimal order by t1.c_int;
select /*+ HASH_JOIN(t1,t2) */  * from t1 join t2 on t1.c_decimal = t2.c_decimal order by t1.c_int;

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

+-------+-----------+-------+-----------+
| c_int | c_decimal | c_int | c_decimal |
+-------+-----------+-------+-----------+
|     1 |  4.064000 |     1 |  4.064000 |
|     3 |  1.010000 |     3 |  1.010000 |
+-------+-----------+-------+-----------+

3. What did you see instead (Required)

mysql> select /*+ INL_MERGE_JOIN(t1,t2) */  * from t1 join t2 on t1.c_decimal = t2.c_decimal order by t1.c_int;
+-------+-----------+-------+-----------+
| c_int | c_decimal | c_int | c_decimal |
+-------+-----------+-------+-----------+
|     1 |  4.064000 |     1 |  4.064000 |
|     3 |  1.010000 |     3 |  1.010000 |
+-------+-----------+-------+-----------+
2 rows in set (0.09 sec)

mysql> select /*+ HASH_JOIN(t1,t2) */  * from t1 join t2 on t1.c_decimal = t2.c_decimal order by t1.c_int;
+-------+-----------+-------+-----------+
| c_int | c_decimal | c_int | c_decimal |
+-------+-----------+-------+-----------+
|     1 |  4.064000 |     1 |  4.064000 |
|     2 |  0.257000 |     3 |  1.010000 |
|     3 |  1.010000 |     3 |  1.010000 |
+-------+-----------+-------+-----------+
3 rows in set (0.06 sec)

4. What is your TiDB version? (Required)

master @ 8978773
release-4.0 @ 7cac557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants