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

Index Join executes wrongly when there's index with column has length #11544

Closed
winoros opened this issue Jul 31, 2019 · 1 comment · Fixed by #11724
Closed

Index Join executes wrongly when there's index with column has length #11544

winoros opened this issue Jul 31, 2019 · 1 comment · Fixed by #11724
Assignees
Labels
sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@winoros
Copy link
Member

winoros commented Jul 31, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
create table t(a int);
create table tt(a int, b varchar(10), index idx(a, b(3)));
insert into t values(1);
insert into tt values(1, 'aaaaaaa'), (1, 'aaaabbb'), (1, 'aaaacccc');
select /*+ TIDB_HJ(tt) */ * from t, tt where t.a=tt.a and tt.b in ('aaaaaaa', 'aaaabbb', 'aaaacccc');
select /*+ TIDB_INLJ(tt) */ * from t, tt where t.a=tt.a and tt.b in ('aaaaaaa', 'aaaabbb', 'aaaacccc');
  1. What did you expect to see?

Both them returns correct dataset.

  1. What did you see instead?

Only hash join returned. Index join returned a empty dataset.

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
@winoros winoros added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner labels Jul 31, 2019
@winoros winoros self-assigned this Jul 31, 2019
@winoros
Copy link
Member Author

winoros commented Jul 31, 2019

Another case relates to index join and index with prefix index column. Though the root cause is not the same.

select /*+ TIDB_INLJ(tt) */ * from t, tt where t.a=tt.a and (tt.b = 'aaaaaaa' or tt.b = 'aaaabbb');

Its result is also a wrong one compared with TIDB_HJ hint.

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

Successfully merging a pull request may close this issue.

1 participant