From d650c65a60c145e610a3c6c11ad3c28e7e05702e Mon Sep 17 00:00:00 2001 From: 924060929 <924060929@qq.com> Date: Tue, 28 May 2024 13:38:17 +0800 Subject: [PATCH] fix mac compile failed by std::abs --- be/src/vec/exec/scan/vfile_scanner.cpp | 1 + be/src/vec/functions/function_string.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/be/src/vec/exec/scan/vfile_scanner.cpp b/be/src/vec/exec/scan/vfile_scanner.cpp index 3a6c9ff7eb7650..6143fbd26812f6 100644 --- a/be/src/vec/exec/scan/vfile_scanner.cpp +++ b/be/src/vec/exec/scan/vfile_scanner.cpp @@ -1,3 +1,4 @@ + // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h index 6db68727b9fdb5..537b5748f3c164 100644 --- a/be/src/vec/functions/function_string.h +++ b/be/src/vec/functions/function_string.h @@ -2460,7 +2460,7 @@ StringRef do_money_format(FunctionContext* context, UInt32 scale, T int_value, T auto multiplier = common::exp10_i128(std::abs(static_cast(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(frac_value / multiplier)) + 5; frac_value /= 10; } else if (scale < 2) { DCHECK(frac_value < 100); @@ -2501,8 +2501,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(frac_value / 10)); + *(result_data + whole_decimal_str_len - 1) = '0' + std::abs(static_cast(frac_value % 10)); return result; };