Skip to content

Commit eedb55c

Browse files
committed
maria db doesn't strip whitespaces in json
1 parent 6f4aee2 commit eedb55c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

flow/e2e/clickhouse_mysql_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,14 @@ func (s ClickHouseSuite) Test_MySQL_Blobs() {
281281
}
282282

283283
func (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

Comments
 (0)