From c17edb149375e320e62725453a26bcd5236a0f90 Mon Sep 17 00:00:00 2001 From: HuaiyuXu <391585975@qq.com> Date: Mon, 8 Jan 2018 17:26:27 +0800 Subject: [PATCH] expression: refine the type infer of group_concat (#5582) --- expression/aggregation/concat.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/expression/aggregation/concat.go b/expression/aggregation/concat.go index fc81fad23edde..3b83f6f1b702c 100644 --- a/expression/aggregation/concat.go +++ b/expression/aggregation/concat.go @@ -20,6 +20,7 @@ import ( "github.com/juju/errors" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/sessionctx/variable" + "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/types" ) @@ -40,7 +41,11 @@ func (cf *concatFunction) Clone() Aggregation { // GetType implements Aggregation interface. func (cf *concatFunction) GetType() *types.FieldType { - return types.NewFieldType(mysql.TypeVarString) + retType := types.NewFieldType(mysql.TypeVarString) + retType.Charset = charset.CharsetUTF8 + retType.Collate = charset.CollationUTF8 + retType.Flen, retType.Decimal = mysql.MaxBlobWidth, 0 + return retType } func (cf *concatFunction) writeValue(ctx *AggEvaluateContext, val types.Datum) {