Skip to content

Commit

Permalink
plan: Fix date_format type infer (pingcap#2152)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli authored and coocood committed Dec 2, 2016
1 parent 8f499c9 commit d1b5f05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plan/typeinferer.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func (v *typeInferrer) handleFuncCallExpr(x *ast.FuncCallExpr) {
case "dayname", "version", "database", "user", "current_user",
"concat", "concat_ws", "left", "lcase", "lower", "repeat",
"replace", "ucase", "upper", "convert", "substring",
"substring_index", "trim", "ltrim", "rtrim", "reverse", "hex", "unhex":
"substring_index", "trim", "ltrim", "rtrim", "reverse", "hex", "unhex", "date_format":
tp = types.NewFieldType(mysql.TypeVarString)
chs = v.defaultCharset
case "strcmp", "isnull":
Expand Down
1 change: 1 addition & 0 deletions plan/typeinferer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func (ts *testTypeInferrerSuite) TestInferType(c *C) {
{"hex(12)", mysql.TypeVarString, "utf8"},
{"unhex('TiDB')", mysql.TypeVarString, "utf8"},
{"unhex(12)", mysql.TypeVarString, "utf8"},
{"DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y')", mysql.TypeVarString, "utf8"},
}
for _, ca := range cases {
ctx := testKit.Se.(context.Context)
Expand Down

0 comments on commit d1b5f05

Please sign in to comment.