github-actions[bot] commented on code in PR #65116:
URL: https://github.com/apache/doris/pull/65116#discussion_r3526629352
##########
be/src/core/data_type_serde/data_type_number_serde.cpp:
##########
@@ -867,22 +875,30 @@ void
DataTypeNumberSerDe<T>::write_one_cell_to_jsonb(const IColumn& column,
// both unsigned integers in Doris types and the JSONB types.
if constexpr (T == TYPE_TINYINT || T == TYPE_BOOLEAN) {
int8_t val = *reinterpret_cast<const int8_t*>(data_ref.data);
- result.writeInt8(val);
+ result.writeInt(val);
} else if constexpr (T == TYPE_SMALLINT) {
int16_t val = *reinterpret_cast<const int16_t*>(data_ref.data);
- result.writeInt16(val);
- } else if constexpr (T == TYPE_INT || T == TYPE_DATEV2 || T == TYPE_IPV4) {
+ result.writeInt(val);
+ } else if constexpr (T == TYPE_INT || T == TYPE_DATEV2) {
+ int32_t val = *reinterpret_cast<const int32_t*>(data_ref.data);
+ result.writeInt(val);
+ } else if constexpr (T == TYPE_IPV4) {
int32_t val = *reinterpret_cast<const int32_t*>(data_ref.data);
result.writeInt32(val);
} else if constexpr (T == TYPE_BIGINT || T == TYPE_DATE || T ==
TYPE_DATETIME ||
T == TYPE_DATETIMEV2 || T == TYPE_TIMESTAMPTZ) {
int64_t val = *reinterpret_cast<const int64_t*>(data_ref.data);
- result.writeInt64(val);
Review Comment:
This changes the persisted row-store JSONB encoding without any
mixed-version gate. `write_one_cell_to_jsonb` is used by
`JsonbSerializeUtil::block_to_jsonb` when segment writers populate the
row-store column, so these bytes can be read later by another BE version. New
readers accept both old and compact tags, but old readers in the removed code
used exact fixed-width payloads such as `unpack<JsonbInt64Val>()` and
`unpack<JsonbInt128Val>()`; `JsonbValue::unpack` is just a raw payload
reinterpret cast. If an upgraded BE writes a BIGINT/DATE/DATETIME value like
`1` as `T_Int8`, an older BE or a rollback path that still expects
`JsonbInt64Val` will read past/misinterpret the payload. The decimal path has
the same issue for DECIMAL32/64/128. Please keep the old fixed-width row-store
encoding until the storage format is version-gated, or only enable compact tags
once all possible readers are known to understand them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]