Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions be/src/core/data_type_serde/data_type_number_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,18 +1409,10 @@ 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);
}
// CastToString uses digits10 + 1 significant digits, which may lose precision.
// ZoneMap bounds must round-trip exactly, so use fmt's shortest round-trippable form.
return fmt::format("{}", v);
} else if constexpr (T == TYPE_TINYINT || T == TYPE_SMALLINT || T == TYPE_INT ||
T == TYPE_BIGINT) {
T == TYPE_BIGINT || T == TYPE_FLOAT || T == TYPE_DOUBLE) {
// Floating number to string is now handled correctly by CastToString::from_number
// in PR https://github.com/apache/doris/pull/65609, special handing here is not necessary now.
return CastToString::from_number(field.get<T>());
} else if constexpr (T == TYPE_LARGEINT) {
auto value = field.get<T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[2.25, 10, 27.5]

-- !percentile_approx_array_3 --
[85.99997711181641, 1.200000047683716, 10, 10]
[85.9999771118164, 1.2000000476837158, 10, 10]

-- !percentile_approx_array_4 --
[2.25, 10, 27.5] [2.25, 10, 27.5]
Expand Down
Loading