@@ -281,9 +281,14 @@ func (s ClickHouseSuite) Test_MySQL_Blobs() {
281281}
282282
283283func (s ClickHouseSuite ) Test_MySQL_JSON_SnapshotCDCConsistency () {
284- if _ , ok := s .source .(* MySqlSource ); ! ok {
284+ mySource , ok := s .source .(* MySqlSource )
285+ if ! ok {
285286 s .t .Skip ("only applies to mysql" )
286287 }
288+ // MySQL stores JSON in a native binary form and re-serializes it to a compact,
289+ // whitespace-stripped text; MariaDB's JSON type is plain LONGTEXT stored verbatim, so
290+ // the exact-representation checks below only hold on MySQL.
291+ nativeJSON := mySource .Config .Flavor == protos .MySqlFlavor_MYSQL_MYSQL
287292
288293 srcTableName := "test_json_repr"
289294 srcFullName := s .attachSchemaSuffix (srcTableName )
@@ -354,7 +359,7 @@ func (s ClickHouseSuite) Test_MySQL_JSON_SnapshotCDCConsistency() {
354359 snapshotGot := fmt .Sprint (rows .Records [i ][1 ].Value ())
355360 cdcGot := fmt .Sprint (rows .Records [i + len (variants )][1 ].Value ())
356361 require .Equal (s .t , snapshotGot , cdcGot , "snapshot/cdc JSON representation differs for %q" , variants [i ].val )
357- if variants [i ].expectExact != "" {
362+ if nativeJSON && variants [i ].expectExact != "" {
358363 require .Equal (s .t , variants [i ].expectExact , snapshotGot , "snapshot JSON not preserved faithfully for %q" , variants [i ].val )
359364 require .Equal (s .t , variants [i ].expectExact , cdcGot , "cdc JSON not preserved faithfully for %q" , variants [i ].val )
360365 }
0 commit comments