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

executor: do not build range for NullOuterVal in IndexLookUpJoin #8505

Merged
merged 5 commits into from Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions executor/builder.go
Expand Up @@ -1895,6 +1895,9 @@ func (builder *dataReaderBuilder) buildTableReaderForIndexJoin(ctx context.Conte
}
handles := make([]int64, 0, len(datums))
for _, datum := range datums {
if datum[0].IsNull() {
winoros marked this conversation as resolved.
Show resolved Hide resolved
continue
}
handles = append(handles, datum[0].GetInt64())
}
return builder.buildTableReaderFromHandles(ctx, e, handles)
Expand Down
17 changes: 17 additions & 0 deletions executor/join_test.go
Expand Up @@ -864,6 +864,23 @@ func (s *testSuite) TestIndexLookupJoin(c *C) {
`1 5 1 1`,
`1 6 1 2`,
))

tk.MustExec(`drop table if exists t1, t2, t3;`)
tk.MustExec("create table t1(a int primary key, b int)")
tk.MustExec("insert into t1 values(1, 0), (2, null)")
tk.MustExec("create table t2(a int primary key)")
tk.MustExec("insert into t2 values(0)")
tk.MustQuery("select /*+ TIDB_INLJ(t2)*/ * from t1 left join t2 on t1.b = t2.a;").Check(testkit.Rows(
`1 0 0`,
`2 <nil> <nil>`,
))

tk.MustExec("create table t3(a int, key(a))")
tk.MustExec("insert into t3 values(0)")
tk.MustQuery("select /*+ TIDB_INLJ(t3)*/ * from t1 left join t3 on t1.b = t3.a;").Check(testkit.Rows(
`1 0 0`,
`2 <nil> <nil>`,
))
}

func (s *testSuite) TestMergejoinOrder(c *C) {
Expand Down