diff --git a/cdc/sink/codec/avro.go b/cdc/sink/codec/avro.go index c64bc828921..eed118c3ce8 100644 --- a/cdc/sink/codec/avro.go +++ b/cdc/sink/codec/avro.go @@ -32,7 +32,6 @@ import ( "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/types" - tijson "github.com/pingcap/tidb/types/json" "go.uber.org/zap" ) @@ -476,7 +475,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 c1ce55c2c48..4b0290fa726 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)