Skip to content

Commit

Permalink
fix mac compile failed by std::abs
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed May 28, 2024
1 parent b8b2aa4 commit d650c65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions be/src/vec/exec/scan/vfile_scanner.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions be/src/vec/functions/function_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<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);
Expand Down Expand Up @@ -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<int>(frac_value / 10));
*(result_data + whole_decimal_str_len - 1) = '0' + std::abs(static_cast<int>(frac_value % 10));
return result;
};

Expand Down

0 comments on commit d650c65

Please sign in to comment.