Skip to content

Commit

Permalink
*: remove useless code. (pingcap#2457)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 authored Jan 15, 2017
1 parent 6731333 commit c470a46
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 19 deletions.
7 changes: 2 additions & 5 deletions executor/executor_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -1170,11 +1170,8 @@ func (e *UpdateExec) fetchRows() error {
}
data := make([]types.Datum, e.SelectExec.Schema().Len())
newData := make([]types.Datum, e.SelectExec.Schema().Len())
for i, s := range e.SelectExec.Schema().Columns {
data[i], err = s.Eval(row.Data, e.ctx)
if err != nil {
return errors.Trace(err)
}
for i := range e.SelectExec.Schema().Columns {
data[i] = row.Data[i]
newData[i] = data[i]
if e.OrderedList[i] != nil {
val, err := e.OrderedList[i].Expr.Eval(row.Data, e.ctx)
Expand Down
7 changes: 0 additions & 7 deletions expression/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ func (s Schema) FindColumn(astCol *ast.ColumnName) (*Column, error) {
return s.Columns[idx], nil
}

// InitColumnIndices sets indices for columns in schema.
func (s Schema) InitColumnIndices() {
for i, c := range s.Columns {
c.Index = i
}
}

// RetrieveColumn retrieves column in expression from the columns in schema.
func (s Schema) RetrieveColumn(col *Column) *Column {
index := s.GetColumnIndex(col)
Expand Down
6 changes: 0 additions & 6 deletions plan/column_pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func (p *Projection) PruneColumns(parentUsedCols []*expression.Column) {
selfUsedCols = append(selfUsedCols, expression.ExtractColumns(expr)...)
}
child.PruneColumns(selfUsedCols)
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand Down Expand Up @@ -96,7 +95,6 @@ func (p *Aggregation) PruneColumns(parentUsedCols []*expression.Column) {
selfUsedCols = append(selfUsedCols, expression.ExtractColumns(expr)...)
}
child.PruneColumns(selfUsedCols)
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand Down Expand Up @@ -128,7 +126,6 @@ func (p *Union) PruneColumns(parentUsedCols []*expression.Column) {
}
child.PruneColumns(newCols)
}
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand All @@ -140,7 +137,6 @@ func (p *DataSource) PruneColumns(parentUsedCols []*expression.Column) {
p.Columns = append(p.Columns[:i], p.Columns[i+1:]...)
}
}
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand Down Expand Up @@ -208,7 +204,6 @@ func (p *Join) PruneColumns(parentUsedCols []*expression.Column) {
} else {
p.schema = composedSchema
}
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand Down Expand Up @@ -246,7 +241,6 @@ func (p *Apply) PruneColumns(parentUsedCols []*expression.Column) {
p.schema = child.GetSchema().Clone()
p.schema.Columns = append(p.schema.Columns, existsCol)
}
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand Down
1 change: 1 addition & 0 deletions plan/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,7 @@ func (b *planBuilder) buildUpdateLists(list []*ast.Assignment, p LogicalPlan) ([
offset := schema.GetColumnIndex(col)
if offset == -1 {
b.err = errors.Trace(errors.Errorf("could not find column %s.%s", col.TblName, col.ColName))
return nil, nil
}
newExpr, np, err := b.rewrite(assign.Expr, p, nil, false)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func (p *baseLogicalPlan) ResolveIndicesAndCorCols() {
for _, child := range p.children {
child.(LogicalPlan).ResolveIndicesAndCorCols()
}
p.schema.InitColumnIndices()
}

// PruneColumns implements LogicalPlan interface.
Expand Down
1 change: 1 addition & 0 deletions plan/resolve_indices.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (p *Apply) ResolveIndicesAndCorCols() {
Column: *childSchema.Columns[idx],
Data: new(types.Datum),
}
resultCorCols[idx].Column.ResolveIndices(childSchema)
}
corCol.Data = resultCorCols[idx].Data
}
Expand Down

0 comments on commit c470a46

Please sign in to comment.