-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
select with join return wrong result #37238
Labels
affects-6.1
affects-6.2
severity/critical
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Comments
Add hint will return right result: select /*+ HASH_JOIN(Tab_A, Tab_B) */ Tab_A.name AAA,Tab_B.name BBB,Tab_A.amt Aamt, Tab_C.amt Bamt,IFNULL(Tab_C.amt, 0)
FROM Tab_A left join Tab_B on Tab_A.bid=Tab_B.id
left join Tab_C on Tab_A.cid=Tab_C.id and Tab_A.type='01'
where Tab_A.num=112; +-----+-----+--------+--------+----------------------+
| AAA | BBB | Aamt | Bamt | IFNULL(Tab_C.amt, 0) |
+-----+-----+--------+--------+----------------------+
| A01 | B01 | 111.00 | 22.00 | 22.00 |
| A02 | B02 | 111.00 | <null> | 0 |
+-----+-----+--------+--------+----------------------+ Here is the plan contrast: |
ti-chi-bot
added
may-affects-4.0
This bug maybe affects 4.0.x versions.
may-affects-5.0
This bug maybe affects 5.0.x versions.
may-affects-5.1
This bug maybe affects 5.1.x versions.
may-affects-5.2
This bug maybe affects 5.2.x versions.
may-affects-5.3
This bug maybe affects 5.3.x versions.
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.0
may-affects-6.1
may-affects-6.2
labels
Aug 19, 2022
12 tasks
AilinKid
added
affects-6.1
affects-6.2
and removed
may-affects-4.0
This bug maybe affects 4.0.x versions.
may-affects-5.1
This bug maybe affects 5.1.x versions.
may-affects-5.2
This bug maybe affects 5.2.x versions.
may-affects-5.3
This bug maybe affects 5.3.x versions.
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-5.0
This bug maybe affects 5.0.x versions.
may-affects-6.0
labels
Aug 19, 2022
12 tasks
ti-chi-bot
pushed a commit
that referenced
this issue
Aug 22, 2022
This was referenced Aug 22, 2022
ti-chi-bot
pushed a commit
that referenced
this issue
Aug 22, 2022
ti-chi-bot
pushed a commit
that referenced
this issue
Aug 23, 2022
ti-chi-bot
pushed a commit
that referenced
this issue
Aug 23, 2022
This was referenced Aug 23, 2022
ti-chi-bot
pushed a commit
that referenced
this issue
Aug 23, 2022
This was referenced Aug 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-6.1
affects-6.2
severity/critical
sig/planner
SIG: Planner
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
MySQL result is:
3. What did you see instead (Required)
TiDB result is:
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: