Skip to content

Commit

Permalink
plan, executor: change 'out of order' to 'keep order'. (pingcap#5607)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 authored Jan 10, 2018
1 parent 4136b81 commit 3cd1066
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ func buildNoRangeIndexReader(b *executorBuilder, v *plan.PhysicalIndexReader) (*
tableID: is.Table.ID,
table: table,
index: is.Index,
keepOrder: !is.OutOfOrder,
keepOrder: is.KeepOrder,
desc: is.Desc,
columns: is.Columns,
priority: b.priority,
Expand Down Expand Up @@ -1243,7 +1243,7 @@ func buildNoRangeIndexLookUpReader(b *executorBuilder, v *plan.PhysicalIndexLook
tableID: is.Table.ID,
table: table,
index: is.Index,
keepOrder: !is.OutOfOrder,
keepOrder: is.KeepOrder,
desc: is.Desc,
tableRequest: tableReq,
columns: is.Columns,
Expand Down
2 changes: 1 addition & 1 deletion plan/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (p *PhysicalIndexScan) ExplainInfo() string {
}
}
}
buffer.WriteString(fmt.Sprintf(", out of order:%v", p.OutOfOrder))
buffer.WriteString(fmt.Sprintf(", keep order:%v", p.KeepOrder))
if p.Desc {
buffer.WriteString(", desc")
}
Expand Down
4 changes: 2 additions & 2 deletions plan/physical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (ds *DataSource) forceToIndexScan(idx *model.IndexInfo, remainedConds []exp
Index: idx,
dataSourceSchema: ds.schema,
Ranges: ranger.FullNewRange(),
OutOfOrder: true,
KeepOrder: false,
}.init(ds.ctx)
is.filterCondition = remainedConds
is.stats = ds.stats
Expand Down Expand Up @@ -373,9 +373,9 @@ func (ds *DataSource) convertToIndexScan(prop *requiredProp, idx *model.IndexInf
cop.tablePlan.(*PhysicalTableScan).appendExtraHandleCol(ds)
}
cop.keepOrder = true
is.KeepOrder = true
is.addPushedDownSelection(cop, ds, prop.expectedCnt)
} else {
is.OutOfOrder = true
expectedCnt := math.MaxFloat64
if prop.isEmpty() {
expectedCnt = prop.expectedCnt
Expand Down
14 changes: 7 additions & 7 deletions plan/physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ type PhysicalIndexScan struct {
AccessCondition []expression.Expression
filterCondition []expression.Expression

Table *model.TableInfo
Index *model.IndexInfo
Ranges []*ranger.NewRange
Columns []*model.ColumnInfo
DBName model.CIStr
Desc bool
OutOfOrder bool
Table *model.TableInfo
Index *model.IndexInfo
Ranges []*ranger.NewRange
Columns []*model.ColumnInfo
DBName model.CIStr
Desc bool
KeepOrder bool
// DoubleRead means if the index executor will read kv two times.
// If the query requires the columns that don't belong to index, DoubleRead will be true.
DoubleRead bool
Expand Down

0 comments on commit 3cd1066

Please sign in to comment.