Skip to content

Commit

Permalink
expression: add unit test for expr_to_pb.go (#3842)
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-jason authored and winoros committed Jul 21, 2017
1 parent 51ff387 commit 90cd982
Show file tree
Hide file tree
Showing 2 changed files with 645 additions and 2 deletions.
4 changes: 2 additions & 2 deletions expression/expr_to_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ func (pc pbConverter) likeToPBExpr(expr *ScalarFunction) *tipb.Expr {
return nil
}
// Only patterns like 'abc', '%abc', 'abc%', '%abc%' can be converted to *tipb.Expr for now.
escape := expr.GetArgs()[2].(*Constant).Value
if escape.IsNull() || byte(escape.GetInt64()) != '\\' {
escape, ok := expr.GetArgs()[2].(*Constant)
if !ok || escape.Value.IsNull() || byte(escape.Value.GetInt64()) != '\\' {
return nil
}
pattern, ok := expr.GetArgs()[1].(*Constant)
Expand Down
Loading

0 comments on commit 90cd982

Please sign in to comment.