You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2024/07/02 09:45:40 UTC

(doris) branch branch-2.1 updated: [fix](compile) fix compile failed on MacOS due to ambiguous std::abs (#37136)

This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 239bc1a7e0d [fix](compile) fix compile failed on MacOS due to ambiguous std::abs (#37136)
239bc1a7e0d is described below

commit 239bc1a7e0d8f07ed3cd00f2eea7da143185c40f
Author: camby <ca...@tencent.com>
AuthorDate: Tue Jul 2 17:45:33 2024 +0800

    [fix](compile) fix compile failed on MacOS due to ambiguous std::abs (#37136)
    
    cherry-pick #35125 to branch-2.1
    
    Co-authored-by: morrySnow <10...@users.noreply.github.com>
---
 be/src/vec/functions/function_string.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h
index 51e1d624062..4096bcca6d3 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -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;
 };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org