Skip to content

Commit

Permalink
plan: tiny clean (pingcap#5169)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 authored and XuHuaiyu committed Nov 21, 2017
1 parent e7ac006 commit 995a587
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
9 changes: 1 addition & 8 deletions plan/column_pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,8 @@ func (p *SelectLock) PruneColumns(parentUsedCols []*expression.Column) {
if p.Lock != ast.SelectLockForUpdate {
p.baseLogicalPlan.PruneColumns(parentUsedCols)
} else {
used := getUsedList(parentUsedCols, p.schema)
for _, cols := range p.children[0].Schema().TblID2Handle {
for _, col := range cols {
col.ResolveIndices(p.children[0].Schema())
if !used[col.Index] {
used[col.Index] = true
parentUsedCols = append(parentUsedCols, col)
}
}
parentUsedCols = append(parentUsedCols, cols...)
}
p.children[0].(LogicalPlan).PruneColumns(parentUsedCols)
}
Expand Down
25 changes: 12 additions & 13 deletions plan/physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ func (p *PhysicalIndexLookUpReader) Copy() PhysicalPlan {

// PhysicalIndexScan represents an index scan plan.
type PhysicalIndexScan struct {
physicalTableSource
*basePlan
basePhysicalPlan

// AccessCondition is used to calculate range.
AccessCondition []expression.Expression
filterCondition []expression.Expression

Table *model.TableInfo
Index *model.IndexInfo
Expand Down Expand Up @@ -157,17 +162,6 @@ func (p *PhysicalMemTable) Copy() PhysicalPlan {
return &np
}

type physicalTableSource struct {
*basePlan
basePhysicalPlan

// AccessCondition is used to calculate range.
AccessCondition []expression.Expression

// filterCondition is only used by new planner.
filterCondition []expression.Expression
}

func needCount(af aggregation.Aggregation) bool {
return af.GetName() == ast.AggFuncCount || af.GetName() == ast.AggFuncAvg
}
Expand All @@ -179,7 +173,12 @@ func needValue(af aggregation.Aggregation) bool {

// PhysicalTableScan represents a table scan plan.
type PhysicalTableScan struct {
physicalTableSource
*basePlan
basePhysicalPlan

// AccessCondition is used to calculate range.
AccessCondition []expression.Expression
filterCondition []expression.Expression

Table *model.TableInfo
Columns []*model.ColumnInfo
Expand Down

0 comments on commit 995a587

Please sign in to comment.