Skip to content

Commit 0068e66

Browse files
Convert JSONB to JSON in CH (#3143)
As addition to #3119 this PR converts JSONB to CH JSON as well.
1 parent b5973e3 commit 0068e66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

flow/connectors/clickhouse/qrep_avro_sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func (s *ClickHouseAvroSyncMethod) pushS3DataToClickHouse(
281281

282282
avroColName = peerdb_clickhouse.QuoteIdentifier(avroColName)
283283

284-
if field.Type == types.QValueKindJSON &&
284+
if (field.Type == types.QValueKindJSON || field.Type == types.QValueKindJSONB) &&
285285
qvalue.ShouldUseNativeJSONType(ctx, config.Env, s.ClickHouseConnector.chVersion) {
286286
avroColName = fmt.Sprintf("JSONExtractString(%s)", avroColName)
287287
}

flow/model/qvalue/kind.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func ToDWHColumnType(
8686
return "", err
8787
}
8888
colType = fmt.Sprintf("Array(%s)", colType)
89-
} else if kind == types.QValueKindJSON && ShouldUseNativeJSONType(ctx, env, dwhVersion) {
89+
} else if (kind == types.QValueKindJSON || kind == types.QValueKindJSONB) && ShouldUseNativeJSONType(ctx, env, dwhVersion) {
9090
colType = "JSON"
9191
} else if val, ok := types.QValueKindToClickHouseTypeMap[kind]; ok {
9292
colType = val

0 commit comments

Comments
 (0)