github-actions[bot] commented on code in PR #65302:
URL: https://github.com/apache/doris/pull/65302#discussion_r3537629210
##########
be/src/core/data_type_serde/data_type_number_serde.cpp:
##########
@@ -944,8 +944,17 @@ std::string DataTypeNumberSerDe<T>::to_olap_string(const
Field& field) const {
char buf[8] = {'\0'};
snprintf(buf, sizeof(buf), "%d", field.get<T>());
return std::string(buf);
+ } else if constexpr (T == TYPE_FLOAT || T == TYPE_DOUBLE) {
+ auto v = field.get<T>();
+ // inf/nan are stored as zone-map flags, not in min/max strings; route
them
+ // through CastToString to keep the "Infinity"/"NaN" spelling used
elsewhere.
+ if (std::isinf(v) || std::isnan(v)) {
+ return CastToString::from_number(v);
+ }
+ // Shortest round-trippable form.
+ return fmt::format("{}", v);
Review Comment:
This fixes the writer for new zone maps, but it still leaves existing
segments written by the old formatter broken. A segment that already persisted
finite `DOUBLE` extremes has `has_positive_inf/has_negative_inf/has_nan ==
false` and min/max strings like `1.797693134862316e+308` /
`-1.797693134862316e+308` from the old `digits10 + 1` path. On read,
`ZoneMap::from_proto` still reparses those stored strings through
`from_zonemap_string`; they parse to infinities and hit the unchanged
NaN/Infinity rejection, or through the nullable wrapper become Null-typed
fields. The new test only builds a zone map with this new formatter, so it does
not cover already-written segment metadata. Please add reader-side
compatibility for those legacy rounded boundary spellings (mapping them back to
`numeric_limits<double>::max()/lowest()` in the zone-map/storage string path)
and add a test that manually constructs a legacy `ZoneMapPB` with the old
strings.
--
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]