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

planner, executor: index join enhancement #8471

Merged
merged 42 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5bdb46f
planner, executor: index join enhancement
winoros Nov 27, 2018
029c6fd
tiny fix
winoros Nov 27, 2018
92570d6
fix sqllogic-test
winoros Nov 27, 2018
3f4c9b9
fix sqllogic test again
winoros Nov 28, 2018
dbe54c9
add comment
winoros Nov 28, 2018
519f562
fix explain result
winoros Dec 10, 2018
3a0b74c
fix string method
winoros Dec 13, 2018
a67e026
Merge branch 'master' into indexjoin-enhancement
winoros Dec 13, 2018
7d5c4df
add unit test and fix things found in it
winoros Dec 13, 2018
ff45b3f
Merge branch 'master' into indexjoin-enhancement
winoros Dec 13, 2018
16196a1
more clear fix and remove unused changes
winoros Dec 13, 2018
d9d51d8
fix unit-test and explain test
winoros Dec 13, 2018
e5f6a93
Merge branch 'master' into indexjoin-enhancement
winoros Feb 18, 2019
b9c4341
Merge branch 'master' into indexjoin-enhancement
winoros Feb 18, 2019
1d576a5
address comments
winoros Feb 19, 2019
b68fde3
split big method
winoros Feb 20, 2019
c020c57
Merge branch 'master' into indexjoin-enhancement
winoros Feb 25, 2019
2829951
address comments
winoros Feb 27, 2019
6af174d
address comments
winoros Mar 4, 2019
209f4f3
address comments
winoros Mar 4, 2019
90b9ee8
Merge branch 'master' into indexjoin-enhancement
winoros Mar 4, 2019
5382511
Merge branch 'master' into indexjoin-enhancement
zz-jason Mar 5, 2019
d738794
address comments
winoros Mar 6, 2019
fbc01eb
Merge branch 'indexjoin-enhancement' of https://github.com/winoros/ti…
winoros Mar 6, 2019
96ac2e7
address comments
winoros Mar 7, 2019
12a1e60
rename method
winoros Mar 7, 2019
d617511
Merge branch 'master' into indexjoin-enhancement
winoros Mar 7, 2019
865777b
Merge branch 'master' into indexjoin-enhancement
winoros Mar 12, 2019
3dbf222
index join can be chosen when there's no eq cond
winoros Mar 12, 2019
1d148f9
Merge branch 'master' into indexjoin-enhancement
winoros Mar 25, 2019
4a0fb65
Merge branch 'master' into indexjoin-enhancement
winoros Mar 27, 2019
00b076d
Merge branch 'master' into indexjoin-enhancement
winoros Apr 15, 2019
1667c2c
typo
winoros Apr 15, 2019
c42ed2c
update to be compatiable with issue#9562
winoros Apr 16, 2019
ba8c208
update logger
winoros Apr 16, 2019
7631437
add some comment
winoros Apr 16, 2019
dca3ff4
fix unit test
winoros Apr 16, 2019
19a06f3
Merge branch 'master' into indexjoin-enhancement
winoros Apr 22, 2019
bfbd3b4
fix explaintest
winoros Apr 22, 2019
662ef3d
address comments
winoros Apr 28, 2019
1c69103
Merge branch 'master' into indexjoin-enhancement
winoros Apr 28, 2019
cba3da9
fix unit test
winoros Apr 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 57 additions & 30 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/pingcap/tidb/metrics"
plannercore "github.com/pingcap/tidb/planner/core"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/statistics"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/types"
Expand Down Expand Up @@ -1086,8 +1085,12 @@ func (b *executorBuilder) buildHashAgg(v *plannercore.PhysicalHashAgg) Executor
e.FinalAggFuncs = append(e.FinalAggFuncs, finalAggFunc)
if partialAggDesc.Name == ast.AggFuncGroupConcat {
// For group_concat, finalAggFunc and partialAggFunc need shared `truncate` flag to do duplicate.
finalAggFunc.(interface{ SetTruncated(t *int32) }).SetTruncated(
partialAggFunc.(interface{ GetTruncated() *int32 }).GetTruncated(),
finalAggFunc.(interface {
winoros marked this conversation as resolved.
Show resolved Hide resolved
SetTruncated(t *int32)
}).SetTruncated(
partialAggFunc.(interface {
GetTruncated() *int32
}).GetTruncated(),
)
}
}
Expand Down Expand Up @@ -1620,10 +1623,11 @@ func (b *executorBuilder) buildIndexLookUpJoin(v *plannercore.PhysicalIndexJoin)
readerBuilder: &dataReaderBuilder{innerPlan, b},
rowTypes: innerTypes,
},
workerWg: new(sync.WaitGroup),
joiner: newJoiner(b.ctx, v.JoinType, v.OuterIndex == 1, defaultValues, v.OtherConditions, leftTypes, rightTypes),
indexRanges: v.Ranges,
keyOff2IdxOff: v.KeyOff2IdxOff,
workerWg: new(sync.WaitGroup),
joiner: newJoiner(b.ctx, v.JoinType, v.OuterIndex == 1, defaultValues, v.OtherConditions, leftTypes, rightTypes),
indexRanges: v.Ranges,
keyOff2IdxOff: v.KeyOff2IdxOff,
nextColCompareFilters: v.CompareFilters,
}
outerKeyCols := make([]int, len(v.OuterJoinKeys))
for i := 0; i < len(v.OuterJoinKeys); i++ {
Expand Down Expand Up @@ -1848,25 +1852,25 @@ type dataReaderBuilder struct {
*executorBuilder
}

func (builder *dataReaderBuilder) buildExecutorForIndexJoin(ctx context.Context, datums [][]types.Datum,
IndexRanges []*ranger.Range, keyOff2IdxOff []int) (Executor, error) {
func (builder *dataReaderBuilder) buildExecutorForIndexJoin(ctx context.Context, lookUpContents []*indexJoinLookUpContent,
IndexRanges []*ranger.Range, keyOff2IdxOff []int, cwc *plannercore.ColWithCompareOps) (Executor, error) {
switch v := builder.Plan.(type) {
case *plannercore.PhysicalTableReader:
return builder.buildTableReaderForIndexJoin(ctx, v, datums)
return builder.buildTableReaderForIndexJoin(ctx, v, lookUpContents)
case *plannercore.PhysicalIndexReader:
return builder.buildIndexReaderForIndexJoin(ctx, v, datums, IndexRanges, keyOff2IdxOff)
return builder.buildIndexReaderForIndexJoin(ctx, v, lookUpContents, IndexRanges, keyOff2IdxOff, cwc)
case *plannercore.PhysicalIndexLookUpReader:
return builder.buildIndexLookUpReaderForIndexJoin(ctx, v, datums, IndexRanges, keyOff2IdxOff)
return builder.buildIndexLookUpReaderForIndexJoin(ctx, v, lookUpContents, IndexRanges, keyOff2IdxOff, cwc)
case *plannercore.PhysicalUnionScan:
return builder.buildUnionScanForIndexJoin(ctx, v, datums, IndexRanges, keyOff2IdxOff)
return builder.buildUnionScanForIndexJoin(ctx, v, lookUpContents, IndexRanges, keyOff2IdxOff, cwc)
}
return nil, errors.New("Wrong plan type for dataReaderBuilder")
}

func (builder *dataReaderBuilder) buildUnionScanForIndexJoin(ctx context.Context, v *plannercore.PhysicalUnionScan,
values [][]types.Datum, indexRanges []*ranger.Range, keyOff2IdxOff []int) (Executor, error) {
values []*indexJoinLookUpContent, indexRanges []*ranger.Range, keyOff2IdxOff []int, cwc *plannercore.ColWithCompareOps) (Executor, error) {
childBuilder := &dataReaderBuilder{v.Children()[0], builder.executorBuilder}
reader, err := childBuilder.buildExecutorForIndexJoin(ctx, values, indexRanges, keyOff2IdxOff)
reader, err := childBuilder.buildExecutorForIndexJoin(ctx, values, indexRanges, keyOff2IdxOff, cwc)
if err != nil {
return nil, err
}
Expand All @@ -1879,14 +1883,14 @@ func (builder *dataReaderBuilder) buildUnionScanForIndexJoin(ctx context.Context
return us, nil
}

func (builder *dataReaderBuilder) buildTableReaderForIndexJoin(ctx context.Context, v *plannercore.PhysicalTableReader, datums [][]types.Datum) (Executor, error) {
func (builder *dataReaderBuilder) buildTableReaderForIndexJoin(ctx context.Context, v *plannercore.PhysicalTableReader, lookUpContents []*indexJoinLookUpContent) (Executor, error) {
e, err := buildNoRangeTableReader(builder.executorBuilder, v)
if err != nil {
return nil, errors.Trace(err)
}
handles := make([]int64, 0, len(datums))
for _, datum := range datums {
handles = append(handles, datum[0].GetInt64())
handles := make([]int64, 0, len(lookUpContents))
for _, content := range lookUpContents {
handles = append(handles, content.keys[0].GetInt64())
}
return builder.buildTableReaderFromHandles(ctx, e, handles)
}
Expand Down Expand Up @@ -1915,12 +1919,12 @@ func (builder *dataReaderBuilder) buildTableReaderFromHandles(ctx context.Contex
}

func (builder *dataReaderBuilder) buildIndexReaderForIndexJoin(ctx context.Context, v *plannercore.PhysicalIndexReader,
values [][]types.Datum, indexRanges []*ranger.Range, keyOff2IdxOff []int) (Executor, error) {
lookUpContents []*indexJoinLookUpContent, indexRanges []*ranger.Range, keyOff2IdxOff []int, cwc *plannercore.ColWithCompareOps) (Executor, error) {
e, err := buildNoRangeIndexReader(builder.executorBuilder, v)
if err != nil {
return nil, errors.Trace(err)
}
kvRanges, err := buildKvRangesForIndexJoin(e.ctx.GetSessionVars().StmtCtx, e.physicalTableID, e.index.ID, values, indexRanges, keyOff2IdxOff)
kvRanges, err := buildKvRangesForIndexJoin(e.ctx, e.physicalTableID, e.index.ID, lookUpContents, indexRanges, keyOff2IdxOff, cwc)
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -1929,12 +1933,12 @@ func (builder *dataReaderBuilder) buildIndexReaderForIndexJoin(ctx context.Conte
}

func (builder *dataReaderBuilder) buildIndexLookUpReaderForIndexJoin(ctx context.Context, v *plannercore.PhysicalIndexLookUpReader,
values [][]types.Datum, indexRanges []*ranger.Range, keyOff2IdxOff []int) (Executor, error) {
lookUpContents []*indexJoinLookUpContent, indexRanges []*ranger.Range, keyOff2IdxOff []int, cwc *plannercore.ColWithCompareOps) (Executor, error) {
e, err := buildNoRangeIndexLookUpReader(builder.executorBuilder, v)
if err != nil {
return nil, errors.Trace(err)
}
kvRanges, err := buildKvRangesForIndexJoin(e.ctx.GetSessionVars().StmtCtx, e.physicalTableID, e.index.ID, values, indexRanges, keyOff2IdxOff)
kvRanges, err := buildKvRangesForIndexJoin(e.ctx, e.physicalTableID, e.index.ID, lookUpContents, indexRanges, keyOff2IdxOff, cwc)
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -1943,17 +1947,40 @@ func (builder *dataReaderBuilder) buildIndexLookUpReaderForIndexJoin(ctx context
}

// buildKvRangesForIndexJoin builds kv ranges for index join when the inner plan is index scan plan.
func buildKvRangesForIndexJoin(sc *stmtctx.StatementContext, tableID, indexID int64, keyDatums [][]types.Datum, indexRanges []*ranger.Range, keyOff2IdxOff []int) ([]kv.KeyRange, error) {
kvRanges := make([]kv.KeyRange, 0, len(indexRanges)*len(keyDatums))
for _, val := range keyDatums {
for _, ran := range indexRanges {
func buildKvRangesForIndexJoin(ctx sessionctx.Context, tableID, indexID int64, lookUpContents []*indexJoinLookUpContent,
ranges []*ranger.Range, keyOff2IdxOff []int, cwc *plannercore.ColWithCompareOps) ([]kv.KeyRange, error) {
kvRanges := make([]kv.KeyRange, 0, len(ranges)*len(lookUpContents))
lastPos := len(ranges[0].LowVal) - 1
sc := ctx.GetSessionVars().StmtCtx
for _, content := range lookUpContents {
for _, ran := range ranges {
for keyOff, idxOff := range keyOff2IdxOff {
ran.LowVal[idxOff] = val[keyOff]
ran.HighVal[idxOff] = val[keyOff]
ran.LowVal[idxOff] = content.keys[keyOff]
ran.HighVal[idxOff] = content.keys[keyOff]
}
}
if cwc != nil {
nextColRanges, err := cwc.BuildRangesByRow(ctx, content.row)
if err != nil {
return nil, err
}
for _, nextColRan := range nextColRanges {
for _, ran := range ranges {
ran.LowVal[lastPos] = nextColRan.LowVal[0]
ran.HighVal[lastPos] = nextColRan.HighVal[0]
ran.LowExclude = nextColRan.LowExclude
ran.HighExclude = nextColRan.HighExclude
}
tmpKvRanges, err := distsql.IndexRangesToKVRanges(sc, tableID, indexID, ranges, nil)
if err != nil {
return nil, errors.Trace(err)
}
kvRanges = append(kvRanges, tmpKvRanges...)
}
continue
}

tmpKvRanges, err := distsql.IndexRangesToKVRanges(sc, tableID, indexID, indexRanges, nil)
tmpKvRanges, err := distsql.IndexRangesToKVRanges(sc, tableID, indexID, ranges, nil)
if err != nil {
return nil, errors.Trace(err)
}
Expand Down
21 changes: 9 additions & 12 deletions executor/executor_pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
package executor

import (
"time"

. "github.com/pingcap/check"
"github.com/pingcap/parser/ast"
"github.com/pingcap/parser/auth"
"github.com/pingcap/parser/model"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/tidb/expression"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/chunk"
Expand Down Expand Up @@ -128,7 +125,7 @@ func buildSchema(names []string, ftypes []byte) *expression.Schema {
return schema
}

func (s *testExecSuite) TestBuildKvRangesForIndexJoin(c *C) {
func (s *testExecSuite) TestBuildKvRangesForIndexJoinWithoutCwc(c *C) {
indexRanges := make([]*ranger.Range, 0, 6)
indexRanges = append(indexRanges, generateIndexRange(1, 1, 1, 1, 1))
indexRanges = append(indexRanges, generateIndexRange(1, 1, 2, 1, 1))
Expand All @@ -137,16 +134,16 @@ func (s *testExecSuite) TestBuildKvRangesForIndexJoin(c *C) {
indexRanges = append(indexRanges, generateIndexRange(2, 1, 1, 1, 1))
indexRanges = append(indexRanges, generateIndexRange(2, 1, 2, 1, 1))

joinKeyRows := make([][]types.Datum, 0, 5)
joinKeyRows = append(joinKeyRows, generateDatumSlice(1, 1))
joinKeyRows = append(joinKeyRows, generateDatumSlice(1, 2))
joinKeyRows = append(joinKeyRows, generateDatumSlice(2, 1))
joinKeyRows = append(joinKeyRows, generateDatumSlice(2, 2))
joinKeyRows = append(joinKeyRows, generateDatumSlice(2, 3))
joinKeyRows := make([]*indexJoinLookUpContent, 0, 5)
joinKeyRows = append(joinKeyRows, &indexJoinLookUpContent{keys: generateDatumSlice(1, 1)})
joinKeyRows = append(joinKeyRows, &indexJoinLookUpContent{keys: generateDatumSlice(1, 2)})
joinKeyRows = append(joinKeyRows, &indexJoinLookUpContent{keys: generateDatumSlice(2, 1)})
joinKeyRows = append(joinKeyRows, &indexJoinLookUpContent{keys: generateDatumSlice(2, 2)})
joinKeyRows = append(joinKeyRows, &indexJoinLookUpContent{keys: generateDatumSlice(2, 3)})

keyOff2IdxOff := []int{1, 3}
sc := &stmtctx.StatementContext{TimeZone: time.Local}
kvRanges, err := buildKvRangesForIndexJoin(sc, 0, 0, joinKeyRows, indexRanges, keyOff2IdxOff)
ctx := mock.NewContext()
kvRanges, err := buildKvRangesForIndexJoin(ctx, 0, 0, joinKeyRows, indexRanges, keyOff2IdxOff, nil)
c.Assert(err, IsNil)
// Check the kvRanges is in order.
for i, kvRange := range kvRanges {
Expand Down
71 changes: 42 additions & 29 deletions executor/index_lookup_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/pingcap/parser/mysql"
"github.com/pingcap/parser/terror"
"github.com/pingcap/tidb/expression"
plannercore "github.com/pingcap/tidb/planner/core"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/types"
Expand Down Expand Up @@ -67,6 +68,8 @@ type IndexLookUpJoin struct {
keyOff2IdxOff []int
innerPtrBytes [][]byte

nextColCompareFilters *plannercore.ColWithCompareOps
winoros marked this conversation as resolved.
Show resolved Hide resolved

memTracker *memory.Tracker // track memory usage.
}

Expand Down Expand Up @@ -123,8 +126,9 @@ type innerWorker struct {
ctx sessionctx.Context
executorChk *chunk.Chunk

indexRanges []*ranger.Range
keyOff2IdxOff []int
indexRanges []*ranger.Range
nextColCompareFilters *plannercore.ColWithCompareOps
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we have a better name for this variable.

keyOff2IdxOff []int
}

// Open implements the Executor interface.
Expand Down Expand Up @@ -196,13 +200,14 @@ func (e *IndexLookUpJoin) newInnerWorker(taskCh chan *lookUpJoinTask) *innerWork
copiedRanges = append(copiedRanges, ran.Clone())
}
iw := &innerWorker{
innerCtx: e.innerCtx,
outerCtx: e.outerCtx,
taskCh: taskCh,
ctx: e.ctx,
executorChk: chunk.NewChunkWithCapacity(e.innerCtx.rowTypes, e.maxChunkSize),
indexRanges: copiedRanges,
keyOff2IdxOff: e.keyOff2IdxOff,
innerCtx: e.innerCtx,
outerCtx: e.outerCtx,
taskCh: taskCh,
ctx: e.ctx,
executorChk: chunk.NewChunkWithCapacity(e.innerCtx.rowTypes, e.maxChunkSize),
indexRanges: copiedRanges,
keyOff2IdxOff: e.keyOff2IdxOff,
nextColCompareFilters: e.nextColCompareFilters,
}
return iw
}
Expand Down Expand Up @@ -423,13 +428,18 @@ func (iw *innerWorker) run(ctx context.Context, wg *sync.WaitGroup) {
}
}

type indexJoinLookUpContent struct {
keys []types.Datum
row chunk.Row
}

func (iw *innerWorker) handleTask(ctx context.Context, task *lookUpJoinTask) error {
dLookUpKeys, err := iw.constructDatumLookupKeys(task)
lookUpContents, err := iw.constructDatumLookupKeys(task)
if err != nil {
return errors.Trace(err)
}
dLookUpKeys = iw.sortAndDedupDatumLookUpKeys(dLookUpKeys)
err = iw.fetchInnerResults(ctx, task, dLookUpKeys)
lookUpContents = iw.sortAndDedupLookUpContents(lookUpContents)
err = iw.fetchInnerResults(ctx, task, lookUpContents)
if err != nil {
return errors.Trace(err)
}
Expand All @@ -440,8 +450,8 @@ func (iw *innerWorker) handleTask(ctx context.Context, task *lookUpJoinTask) err
return nil
}

func (iw *innerWorker) constructDatumLookupKeys(task *lookUpJoinTask) ([][]types.Datum, error) {
dLookUpKeys := make([][]types.Datum, 0, task.outerResult.NumRows())
func (iw *innerWorker) constructDatumLookupKeys(task *lookUpJoinTask) ([]*indexJoinLookUpContent, error) {
winoros marked this conversation as resolved.
Show resolved Hide resolved
lookUpContents := make([]*indexJoinLookUpContent, 0, task.outerResult.NumRows())
keyBuf := make([]byte, 0, 64)
for i := 0; i < task.outerResult.NumRows(); i++ {
dLookUpKey, err := iw.constructDatumLookupKey(task, i)
Expand All @@ -460,11 +470,11 @@ func (iw *innerWorker) constructDatumLookupKeys(task *lookUpJoinTask) ([][]types
}
// Store the encoded lookup key in chunk, so we can use it to lookup the matched inners directly.
task.encodedLookUpKeys.AppendBytes(0, keyBuf)
dLookUpKeys = append(dLookUpKeys, dLookUpKey)
lookUpContents = append(lookUpContents, &indexJoinLookUpContent{keys: dLookUpKey, row: task.outerResult.GetRow(i)})
}

task.memTracker.Consume(task.encodedLookUpKeys.MemoryUsage())
return dLookUpKeys, nil
return lookUpContents, nil
}

func (iw *innerWorker) constructDatumLookupKey(task *lookUpJoinTask, rowIdx int) ([]types.Datum, error) {
Expand Down Expand Up @@ -496,20 +506,23 @@ func (iw *innerWorker) constructDatumLookupKey(task *lookUpJoinTask, rowIdx int)
return dLookupKey, nil
}

func (iw *innerWorker) sortAndDedupDatumLookUpKeys(dLookUpKeys [][]types.Datum) [][]types.Datum {
if len(dLookUpKeys) < 2 {
return dLookUpKeys
func (iw *innerWorker) sortAndDedupLookUpContents(lookUpContents []*indexJoinLookUpContent) []*indexJoinLookUpContent {
if len(lookUpContents) < 2 {
return lookUpContents
}
sc := iw.ctx.GetSessionVars().StmtCtx
sort.Slice(dLookUpKeys, func(i, j int) bool {
cmp := compareRow(sc, dLookUpKeys[i], dLookUpKeys[j])
return cmp < 0
sort.Slice(lookUpContents, func(i, j int) bool {
cmp := compareRow(sc, lookUpContents[i].keys, lookUpContents[j].keys)
if cmp != 0 || iw.nextColCompareFilters == nil {
return cmp < 0
}
return iw.nextColCompareFilters.CompareRow(lookUpContents[i].row, lookUpContents[j].row) < 0
})
deDupedLookupKeys := dLookUpKeys[:1]
for i := 1; i < len(dLookUpKeys); i++ {
cmp := compareRow(sc, dLookUpKeys[i], dLookUpKeys[i-1])
if cmp != 0 {
deDupedLookupKeys = append(deDupedLookupKeys, dLookUpKeys[i])
deDupedLookupKeys := lookUpContents[:1]
for i := 1; i < len(lookUpContents); i++ {
cmp := compareRow(sc, lookUpContents[i].keys, lookUpContents[i-1].keys)
if cmp != 0 || (iw.nextColCompareFilters != nil && iw.nextColCompareFilters.CompareRow(lookUpContents[i].row, lookUpContents[i-1].row) != 0) {
deDupedLookupKeys = append(deDupedLookupKeys, lookUpContents[i])
}
}
return deDupedLookupKeys
Expand All @@ -529,8 +542,8 @@ func compareRow(sc *stmtctx.StatementContext, left, right []types.Datum) int {
return 0
}

func (iw *innerWorker) fetchInnerResults(ctx context.Context, task *lookUpJoinTask, dLookUpKeys [][]types.Datum) error {
innerExec, err := iw.readerBuilder.buildExecutorForIndexJoin(ctx, dLookUpKeys, iw.indexRanges, iw.keyOff2IdxOff)
func (iw *innerWorker) fetchInnerResults(ctx context.Context, task *lookUpJoinTask, lookUpContent []*indexJoinLookUpContent) error {
innerExec, err := iw.readerBuilder.buildExecutorForIndexJoin(ctx, lookUpContent, iw.indexRanges, iw.keyOff2IdxOff, iw.nextColCompareFilters)
if err != nil {
return errors.Trace(err)
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/golang/protobuf v1.2.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v1.6.2
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
Expand Down
Loading