[fix](compile) fix compile failed on MacOS due to ambiguous std::abs (#37136)

cherry-pick #35125 to branch-2.1

Co-authored-by: morrySnow <101034200+morrySnow@users.noreply.github.com>
This commit is contained in:
camby
2024-07-02 17:45:33 +08:00
committed by GitHub
parent f5d0cdeeb4
commit 239bc1a7e0

View File

@ -3018,7 +3018,7 @@ StringRef do_money_format(FunctionContext* context, UInt32 scale, T int_value, T
auto multiplier = common::exp10_i128(std::abs(static_cast<int>(scale - 3)));
// do devide first to avoid overflow
// after round frac_value will be positive by design.
frac_value = std::abs(frac_value / multiplier) + 5;
frac_value = std::abs(static_cast<int>(frac_value / multiplier)) + 5;
frac_value /= 10;
} else if (scale < 2) {
DCHECK(frac_value < 100);
@ -3059,8 +3059,8 @@ StringRef do_money_format(FunctionContext* context, UInt32 scale, T int_value, T
memcpy(result_data + (append_sign_manually ? 1 : 0), p, integer_str_len);
*(result_data + whole_decimal_str_len - 3) = '.';
*(result_data + whole_decimal_str_len - 2) = '0' + std::abs(frac_value / 10);
*(result_data + whole_decimal_str_len - 1) = '0' + std::abs(frac_value % 10);
*(result_data + whole_decimal_str_len - 2) = '0' + std::abs(static_cast<int>(frac_value / 10));
*(result_data + whole_decimal_str_len - 1) = '0' + std::abs(static_cast<int>(frac_value % 10));
return result;
};