Skip to content

Commit

Permalink
clean useless code.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 committed Nov 14, 2016
1 parent 5b21b00 commit 70846fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 59 deletions.
10 changes: 5 additions & 5 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ type PhysicalPlan interface {
type baseLogicalPlan struct {
basePlan
planMap map[string]*physicalPlanInfo
self Plan
self LogicalPlan
}

func (p *baseLogicalPlan) getPlanInfo(prop *requiredProperty) (*physicalPlanInfo, error) {
Expand Down Expand Up @@ -233,20 +233,20 @@ func newBaseLogicalPlan(tp string, a *idAllocator) baseLogicalPlan {
// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *baseLogicalPlan) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
if len(p.GetChildren()) == 0 {
return predicates, p, nil
return predicates, p.self, nil
}
child := p.GetChildByIndex(0).(LogicalPlan)
rest, _, err := child.PredicatePushDown(predicates)
if err != nil {
return nil, p, errors.Trace(err)
return nil, nil, errors.Trace(err)
}
if len(rest) > 0 {
err = addSelection(p, child, rest, p.allocator)
if err != nil {
return nil, p, errors.Trace(err)
return nil, nil, errors.Trace(err)
}
}
return nil, p, nil
return nil, p.self, nil
}

// PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.
Expand Down
54 changes: 0 additions & 54 deletions plan/predicate_push_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,57 +619,3 @@ func (p *Limit) PredicatePushDown(predicates []expression.Expression) ([]express
_, _, err := p.baseLogicalPlan.PredicatePushDown(nil)
return predicates, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Sort) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Trim) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *MaxOneRow) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Exists) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Distinct) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Insert) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *SelectLock) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Update) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

// PredicatePushDown implements LogicalPlan PredicatePushDown interface.
func (p *Delete) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error) {
ret, _, err := p.baseLogicalPlan.PredicatePushDown(predicates)
return ret, p, errors.Trace(err)
}

0 comments on commit 70846fb

Please sign in to comment.