Skip to content

Commit

Permalink
expression, executor: fix unhex(binary) error (#3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackysp authored and tiancaiamao committed Jul 13, 2017
1 parent 26decf5 commit b7d7779
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,8 @@ func (s *testSuite) TestBuiltin(c *C) {
tk.MustExec(`insert into t values('test')`)
result = tk.MustQuery("select hex(a) from t")
result.Check(testkit.Rows("7465737400000000"))
result = tk.MustQuery("select unhex(a) from t")
result.Check(testkit.Rows("<nil>"))

// select from_unixtime
result = tk.MustQuery("select from_unixtime(1451606400)")
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ func (b *builtinUnHexSig) eval(row []types.Datum) (d types.Datum, err error) {
switch args[0].Kind() {
case types.KindNull:
return d, nil
case types.KindString:
case types.KindString, types.KindBytes:
x, err := args[0].ToString()
if err != nil {
return d, errors.Trace(err)
Expand Down

0 comments on commit b7d7779

Please sign in to comment.