diff --git a/be/src/core/data_type_serde/data_type_number_serde.cpp b/be/src/core/data_type_serde/data_type_number_serde.cpp index 72fcad1a6500ea..df9ccb529dae9a 100644 --- a/be/src/core/data_type_serde/data_type_number_serde.cpp +++ b/be/src/core/data_type_serde/data_type_number_serde.cpp @@ -1409,18 +1409,10 @@ std::string DataTypeNumberSerDe::to_olap_string(const Field& field) const { char buf[8] = {'\0'}; snprintf(buf, sizeof(buf), "%d", field.get()); return std::string(buf); - } else if constexpr (T == TYPE_FLOAT || T == TYPE_DOUBLE) { - auto v = field.get(); - // 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()); } else if constexpr (T == TYPE_LARGEINT) { auto value = field.get(); diff --git a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_percentile_approx_array.out b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_percentile_approx_array.out index 24c27e94901d8f..87afd8bce24d72 100644 --- a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_percentile_approx_array.out +++ b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_percentile_approx_array.out @@ -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]