Skip to content

Commit

Permalink
fix sqllogic test again
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros committed Nov 28, 2018
1 parent 92570d6 commit 3f4c9b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions planner/core/exhaust_physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@ func (cwc *ColWithCompareOps) resolveIndices(schema *expression.Schema) {

func (p *LogicalJoin) analyzeLookUpFilters(indexInfo *model.IndexInfo, innerPlan *DataSource, innerJoinKeys []*expression.Column) ([]*ranger.Range, []int, []expression.Expression, *ColWithCompareOps, error) {
idxCols, colLengths := expression.IndexInfo2Cols(innerPlan.schema.Columns, indexInfo)
log.Warnf("index cols: %v", idxCols)
if len(idxCols) == 0 {
return nil, nil, nil, nil, nil
}
Expand All @@ -629,9 +628,9 @@ func (p *LogicalJoin) analyzeLookUpFilters(indexInfo *model.IndexInfo, innerPlan
if matchedKeyCnt <= 0 {
return nil, nil, nil, nil, nil
}
keyMatchedLen := len(idxCols) - 1
keyMatchedLen := len(idxCols)
for ; keyMatchedLen > 0; keyMatchedLen-- {
if idxOff2keyOff[keyMatchedLen] != -1 {
if idxOff2keyOff[keyMatchedLen-1] != -1 {
break
}
}
Expand All @@ -655,14 +654,14 @@ func (p *LogicalJoin) analyzeLookUpFilters(indexInfo *model.IndexInfo, innerPlan
nextColPos := matchedKeyCnt + len(notKeyEqAndIn)
// If all cols have been considered, we can return the current result.
if nextColPos == len(idxCols) {
remained = append(remained, rangeFilterCandidates...)
ranges, err := p.buildTemplateRange(idxOff2keyOff, matchedKeyCnt, notKeyEqAndIn, nil, false)
if err != nil {
return nil, nil, nil, nil, err
}
return ranges, idxOff2keyOff, remained, nil, nil
}
nextCol := idxCols[nextColPos]
log.Warnf("next col: %v", nextCol)
nextColCmpFilterManager := &ColWithCompareOps{
targetCol: nextCol,
affectedColSchema: expression.NewSchema(),
Expand Down Expand Up @@ -697,7 +696,6 @@ loopCandidates:
nextColCmpFilterManager.appendNewExpr(symmetricOp[sf.FuncName.L], sf.GetArgs()[0], affectedCols)
}
}
log.Warnf("next col filters: %v", nextColCmpFilterManager.opArg)
if len(nextColCmpFilterManager.OpType) == 0 {
colAccesses, colRemained := ranger.DetachCondsForTableRange(p.ctx, rangeFilterCandidates, nextCol)
remained = append(remained, colRemained...)
Expand All @@ -711,6 +709,7 @@ loopCandidates:
}
return ranges, idxOff2keyOff, remained, nil, nil
}
remained = append(remained, rangeFilterCandidates...)
ranges, err := p.buildTemplateRange(idxOff2keyOff, matchedKeyCnt, notKeyEqAndIn, nil, true)
if err != nil {
return nil, nil, nil, nil, err
Expand Down Expand Up @@ -780,6 +779,7 @@ func (p *LogicalJoin) buildTemplateRange(idxOff2KeyOff []int, matchedKeyCnt int,
if err != nil {
return nil, err
}
newRange.HighVal[i] = newRange.LowVal[i]
newRanges = append(newRanges, newRange)
}
ranges = append(ranges, newRanges...)
Expand Down

0 comments on commit 3f4c9b9

Please sign in to comment.