Skip to content

Commit

Permalink
expression: fix type infer for decimal property in count agg (#17368)
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored Jun 5, 2020
1 parent c04c6a5 commit 37455e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions expression/aggregation/base_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (a *baseFuncDesc) typeInfer(ctx sessionctx.Context) error {
func (a *baseFuncDesc) typeInfer4Count(ctx sessionctx.Context) {
a.RetTp = types.NewFieldType(mysql.TypeLonglong)
a.RetTp.Flen = 21
a.RetTp.Decimal = 0
types.SetBinChsClnFlag(a.RetTp)
}

Expand Down
1 change: 1 addition & 0 deletions expression/typeinfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ func (s *testInferTypeSuite) createTestCase4Aggregations() []typeInferTestCase {
{"avg(1.2e2)", mysql.TypeDouble, charset.CharsetBin, mysql.BinaryFlag, mysql.MaxRealWidth, types.UnspecifiedLength},
{"avg(c_char)", mysql.TypeDouble, charset.CharsetBin, mysql.BinaryFlag, mysql.MaxRealWidth, types.UnspecifiedLength},
{"group_concat(c_int_d)", mysql.TypeVarString, charset.CharsetUTF8MB4, 0, mysql.MaxBlobWidth, 0},
{"count(c_decimal)", mysql.TypeLonglong, charset.CharsetBin, mysql.BinaryFlag, 21, 0},
}
}

Expand Down

0 comments on commit 37455e6

Please sign in to comment.