Skip to content

Commit

Permalink
sink(ticdc): fix incorrect sanitize (#12044)
Browse files Browse the repository at this point in the history
close #11727
  • Loading branch information
wk989898 authored Feb 5, 2025
1 parent 77be86e commit e150d73
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/sink/codec/avro/avro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ func TestSanitizeName(t *testing.T) {
common.SanitizeName("1ColumnNameStartWithNumber"),
)
require.Equal(t, "A_B", common.SanitizeName("A.B"))
require.Equal(t, "columnNameWith______", common.SanitizeName("columnNameWith中文"))
require.Equal(t, "columnNameWith__", common.SanitizeName("columnNameWith中文"))
}

func TestGetAvroNamespace(t *testing.T) {
Expand Down
10 changes: 2 additions & 8 deletions pkg/sink/codec/common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@ func SanitizeName(name string) string {
}
changed = true
} else if !isValidNonFirstCharacter(c) {
b := []byte(string(c))
for k := 0; k < len(b); k++ {
sb.WriteString(replacementChar)
}
sb.WriteString(replacementChar)
changed = true
} else {
sb.WriteRune(c)
Expand All @@ -252,10 +249,7 @@ func SanitizeTopicName(name string) string {
var sb strings.Builder
for _, c := range name {
if !isValidNonFirstCharacterForTopicName(c) {
b := []byte(string(c))
for k := 0; k < len(b); k++ {
sb.WriteString(replacementChar)
}
sb.WriteString(replacementChar)
changed = true
} else {
sb.WriteRune(c)
Expand Down
1 change: 1 addition & 0 deletions tests/integration_tests/debezium/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
- CONFIG_STORAGE_TOPIC=my_connect_configs
- OFFSET_STORAGE_TOPIC=my_connect_offsets
- STATUS_STORAGE_TOPIC=my_connect_statuses
- LANG=C.UTF-8
# watcher_dbz: # For Debug Purpose
# restart: always
# image: quay.io/debezium/kafka:2.4
Expand Down

0 comments on commit e150d73

Please sign in to comment.