diff --git a/cdc/sink/codec/avro.go b/cdc/sink/codec/avro.go index 1d6452975ff..7a7b2b3feef 100644 --- a/cdc/sink/codec/avro.go +++ b/cdc/sink/codec/avro.go @@ -30,7 +30,6 @@ import ( "github.com/pingcap/ticdc/cdc/model" cerror "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/tidb/types" - tijson "github.com/pingcap/tidb/types/json" "go.uber.org/zap" ) @@ -474,7 +473,7 @@ func columnToAvroNativeData(col *model.Column, tz *time.Location) (interface{}, case mysql.TypeYear: return col.Value.(int64), "long", nil case mysql.TypeJSON: - return col.Value.(tijson.BinaryJSON).String(), "string", nil + return col.Value.(string), "string", nil case mysql.TypeNewDecimal: return col.Value.(string), "string", nil case mysql.TypeEnum: diff --git a/cdc/sink/codec/avro_test.go b/cdc/sink/codec/avro_test.go index 97074664fa8..779be79c451 100644 --- a/cdc/sink/codec/avro_test.go +++ b/cdc/sink/codec/avro_test.go @@ -88,6 +88,7 @@ func (s *avroBatchEncoderSuite) TestAvroEncodeOnly(c *check.C) { {Name: "myfloat", Value: float64(3.14), Type: mysql.TypeFloat}, {Name: "mybytes", Value: []byte("Hello World"), Type: mysql.TypeBlob}, {Name: "ts", Value: time.Now().Format(types.TimeFSPFormat), Type: mysql.TypeTimestamp}, + {Name: "myjson", Value: "{\"foo\": \"bar\"}", Type: mysql.TypeJSON}, }, time.Local) c.Assert(err, check.IsNil)