github-actions[bot] commented on code in PR #64577:
URL: https://github.com/apache/doris/pull/64577#discussion_r3430453525


##########
be/src/exprs/function/cast/cast_to_string.h:
##########
@@ -118,8 +118,9 @@ struct CastToString {
                 end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,
                                      std::numeric_limits<float>::digits10 + 1);
             } else {
-                end = fmt::format_to(buffer, FMT_COMPILE("{:.{}g}"), value,
-                                     std::numeric_limits<double>::digits10 + 
1);
+                // shortest round-trip, fixed-precision %g would expose 
IEEE-754
+                // residual error e.g. round(23900/293, 2) -> 
"81.56999999999999".
+                end = fmt::format_to(buffer, FMT_COMPILE("{}"), value);

Review Comment:
   Current head updates the direct cast and storage expectations, but this 
helper is also the normal text serialization path for DOUBLE results: 
`DataTypeNumberSerDe::to_string()`/`write_column_to_mysql_text()` call 
`CastToString::push_number`, and array/map serializers delegate to their nested 
numeric serde. Several generated result files for those paths still contain the 
old edge spellings, so they will fail after this formatter change. Examples I 
found include `regression-test/data/export_p0/test_export_data_types.out` 
(`4.940656458412465e-324`, `1.797693134862316e+308`), the outfile array/map 
outputs under `regression-test/data/export_p0/outfile/{csv,parquet}/` and 
`regression-test/data/export_p0/test_outfile_orc_*`, and 
`regression-test/data/nereids_function_p0/scalar_function/Array1.out` with old 
`DOUBLE` min/max strings. With this line those paths now emit values such as 
`5e-324`, `2.2250738585072014e-308`, and `1.7976931348623157e+308`. Please 
regenerate/update all affected r
 esult files. This is distinct from the existing 
`test_cast_to_string_from_float.out` thread because these are ordinary 
result/outfile/complex-type serialization paths, not the explicit cast suite 
already discussed.



-- 
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]

Reply via email to