github-actions[bot] commented on code in PR #68397:
URL: https://github.com/apache/doris/pull/68397#discussion_r4074648007
##########
be/src/exprs/function/function_string_format.h:
##########
@@ -318,11 +320,13 @@ StringRef do_format_round(FunctionContext* context,
UInt32 scale, T int_value, T
*(result_data + whole_decimal_str_len - (frac_str_len + 1)) = '.';
}
- // Convert fractional part to string with proper padding
- T remaining_frac = std::abs(static_cast<int>(frac_value));
- for (int i = 0; i <= decimal_places - 1; ++i) {
- *(result_data + whole_decimal_str_len - 1 - i) = '0' + (remaining_frac
% 10);
- remaining_frac /= 10;
+ // Pad on the right without scaling the value: decimal_places can be as
large as 1024.
+ const Int32 trailing_zeros = decimal_places - scale;
Review Comment:
**[P1] Preserve DecimalV2's full nine-digit fraction**
This padding path can only preserve digits it receives, but
`FormatRoundDecimalImpl` still divides `DecimalV2Value::frac_value()` by
1,000,000 and calls the helper with scale 3. That registered overload remains
reachable when `enable_decimal_conversion=false`:
`format_round(CAST('1.234567891' AS DECIMALV2(27,9)), 3)` therefore returns
`1.234` instead of `1.235`, and at 9 places it returns `1.234000000` instead of
`1.234567891`. Please pass the complete fixed-scale-9 fraction and add
DecimalV2 coverage; otherwise the DecimalV2 fix described by this PR remains
incomplete.
--
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]