From 90e1cd96f6d65fa04a84e053810c1f3e6280c9b1 Mon Sep 17 00:00:00 2001 From: Han Fei Date: Mon, 12 Jul 2021 19:29:32 +0800 Subject: [PATCH] cherry pick #26145 to release-5.1 Signed-off-by: ti-srebot --- planner/core/plan_to_pb.go | 4 ---- planner/core/plan_to_pb_test.go | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/planner/core/plan_to_pb.go b/planner/core/plan_to_pb.go index 1b6ef79bbc6bc..985fb0a72878d 100644 --- a/planner/core/plan_to_pb.go +++ b/planner/core/plan_to_pb.go @@ -16,7 +16,6 @@ package core import ( "github.com/pingcap/errors" "github.com/pingcap/parser/model" - "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/expression/aggregation" @@ -279,9 +278,6 @@ func (e *PhysicalExchangeReceiver) ToPB(ctx sessionctx.Context, storeType kv.Sto fieldTypes := make([]*tipb.FieldType, 0, len(e.Schema().Columns)) for _, column := range e.Schema().Columns { pbType := expression.ToPBFieldType(column.RetType) - if column.RetType.Tp == mysql.TypeEnum { - pbType.Elems = append(pbType.Elems, column.RetType.Elems...) - } fieldTypes = append(fieldTypes, pbType) } ecExec := &tipb.ExchangeReceiver{ diff --git a/planner/core/plan_to_pb_test.go b/planner/core/plan_to_pb_test.go index e16e4aaf826c8..0162cce7397b5 100644 --- a/planner/core/plan_to_pb_test.go +++ b/planner/core/plan_to_pb_test.go @@ -73,4 +73,13 @@ func (s *testDistsqlSuite) TestColumnToProto(c *C) { } pc = util.ColumnToProto(col1) c.Assert(pc.Collation, Equals, int32(-8)) + + tp = types.NewFieldType(mysql.TypeEnum) + tp.Flag = 10 + tp.Elems = []string{"a", "b"} + col2 := &model.ColumnInfo{ + FieldType: *tp, + } + pc = util.ColumnToProto(col2) + c.Assert(len(pc.Elems), Equals, 2) }