github-actions[bot] commented on code in PR #64577:
URL: https://github.com/apache/doris/pull/64577#discussion_r3424353115
##########
fe/fe-common/src/main/java/org/apache/doris/common/FractionalFormat.java:
##########
@@ -59,9 +69,56 @@ public static String getFormatStringValue(double value, int
precision, String sc
}
}
return result;
+ }
+ return String.format(sciFormat,
value).replaceAll("(\\.\\d*?[1-9])0*E", "$1E")
+ .replaceAll("\\.0*E", "E").replaceAll("E", "e");
+ }
+
+ private static String formatShortest(double value, int precision) {
+ // shortest round-trip; new BigDecimal(double) would capture the exact
+ // IEEE-754 value and setScale(16,HALF_UP) would expose its tail,
Review Comment:
This current-head implementation uses Java's `Double.toString(value)` as the
canonical double spelling, but the BE `CastToString` path still emits Doris'
existing longer spellings for edge finite doubles. This is distinct from the
earlier scientific-branch comment: the old `String.format("%.15E")` branch is
gone now, but the replacement is too short for values where BE does not use
Java's spelling. The PR's own BE regression output still has
`cast(cast("4.940656458412465e-324" as double) as string)` returning
`4.940656458412465e-324`; this code returns `4.9e-324` for the same double.
Existing export expectations also keep `Double.MAX_VALUE` as
`1.797693134862316e+308`, while this path formats it as
`1.7976931348623157e+308`. That means FE-folded casts can disagree with runtime
BE casts for those values. Please either match the actual BE formatter for
these edge finite values, or change BE and the existing edge-value regression
expectations together.
--
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]