Skip to content

Commit

Permalink
Merge branch 'master' into dana/soft-deletes-2
Browse files Browse the repository at this point in the history
  • Loading branch information
danafallon authored Jul 17, 2024
2 parents 2d31eed + 6fe5464 commit 3ee0e82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
12 changes: 3 additions & 9 deletions clients/bigquery/storagewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ func rowToMessage(row map[string]any, columns []columns.Column, messageDescripto
return nil, err
}
list := message.Mutable(field).List()
for _, value := range values {
list.Append(protoreflect.ValueOfString(value))
for _, val := range values {
list.Append(protoreflect.ValueOfString(val))
}
default:
return nil, fmt.Errorf("unsupported column kind: %q", column.KindDetails.Kind)
Expand All @@ -235,11 +235,5 @@ func encodeStructToJSONString(value any) (string, error) {
return "", fmt.Errorf("failed to marshal value: %w", err)
}

stringValue := string(bytes)
if strings.Contains(stringValue, constants.ToastUnavailableValuePlaceholder) {
// TODO: Remove this if we don't see it in the logs.
slog.Error("encoded JSON value contains the toast unavailable value placeholder")
return fmt.Sprintf(`{"key":"%s"}`, constants.ToastUnavailableValuePlaceholder), nil
}
return stringValue, nil
return string(bytes), nil
}
6 changes: 0 additions & 6 deletions clients/bigquery/storagewrite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,4 @@ func TestEncodeStructToJSONString(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, `{"baz":1234,"foo":"bar"}`, result)
}
{
// Toasted map (should not happen):
result, err := encodeStructToJSONString(map[string]any{"__debezium_unavailable_value": "bar", "baz": 1234})
assert.NoError(t, err)
assert.Equal(t, `{"key":"__debezium_unavailable_value"}`, result)
}
}

0 comments on commit 3ee0e82

Please sign in to comment.