Skip to content

Commit

Permalink
plan: refine code. (pingcap#5565)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 authored and shenli committed Jan 5, 2018
1 parent c45111d commit c7b13ef
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions plan/physical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,8 @@ func (ds *DataSource) convertToIndexScan(prop *requiredProp, idx *model.IndexInf
return task, nil
}

// TODO: refine this.
func (is *PhysicalIndexScan) initSchema(id int, idx *model.IndexInfo, isDoubleRead bool) {
var indexCols []*expression.Column
indexCols := make([]*expression.Column, 0, len(idx.Columns))
for _, col := range idx.Columns {
indexCols = append(indexCols, &expression.Column{FromID: id, Position: col.Offset})
}
Expand Down Expand Up @@ -455,13 +454,9 @@ func matchIndicesProp(idxCols []*model.IndexColumn, propCols []*expression.Colum
func splitIndexFilterConditions(conditions []expression.Expression, indexColumns []*model.IndexColumn,
table *model.TableInfo) (indexConds, tableConds []expression.Expression) {
var pkName model.CIStr
if table.PKIsHandle {
for _, colInfo := range table.Columns {
if mysql.HasPriKeyFlag(colInfo.Flag) {
pkName = colInfo.Name
break
}
}
pkInfo := table.GetPkColInfo()
if pkInfo != nil {
pkName = pkInfo.Name
}
var indexConditions, tableConditions []expression.Expression
for _, cond := range conditions {
Expand Down

0 comments on commit c7b13ef

Please sign in to comment.