Skip to content

Commit

Permalink
expression: fix unused code in util.go (pingcap#23301)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuGanghui authored Mar 17, 2021
1 parent 77713d2 commit 30be22a
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions expression/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,44 +654,6 @@ func PopRowFirstArg(ctx sessionctx.Context, e Expression) (ret Expression, err e
return
}

// exprStack is a stack of expressions.
type exprStack struct {
stack []Expression
}

// pop pops an expression from the stack.
func (s *exprStack) pop() Expression {
if s.len() == 0 {
return nil
}
lastIdx := s.len() - 1
expr := s.stack[lastIdx]
s.stack = s.stack[:lastIdx]
return expr
}

// popN pops n expressions from the stack.
// If n greater than stack length or n is negative, it pops all the expressions.
func (s *exprStack) popN(n int) []Expression {
if n > s.len() || n < 0 {
n = s.len()
}
idx := s.len() - n
exprs := s.stack[idx:]
s.stack = s.stack[:idx]
return exprs
}

// push pushes one expression to the stack.
func (s *exprStack) push(expr Expression) {
s.stack = append(s.stack, expr)
}

// len returns the length of th stack.
func (s *exprStack) len() int {
return len(s.stack)
}

// DatumToConstant generates a Constant expression from a Datum.
func DatumToConstant(d types.Datum, tp byte, flag uint) *Constant {
t := types.NewFieldType(tp)
Expand Down

0 comments on commit 30be22a

Please sign in to comment.