From 1901f0f35b1647672f16b5fb682c143be9c61e7f Mon Sep 17 00:00:00 2001 From: Jerry Hu Date: Thu, 14 Dec 2023 09:29:22 +0800 Subject: [PATCH] [fix](function) bad performance caused by creating Status::RuntimeError (#28362) --- be/src/vec/functions/function_binary_arithmetic.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/be/src/vec/functions/function_binary_arithmetic.h b/be/src/vec/functions/function_binary_arithmetic.h index a58417b71e..1cc67804ec 100644 --- a/be/src/vec/functions/function_binary_arithmetic.h +++ b/be/src/vec/functions/function_binary_arithmetic.h @@ -961,8 +961,7 @@ public: } bool check_overflow_for_decimal = context->check_overflow_for_decimal(); - auto status = Status::RuntimeError("{}'s arguments do not match the expected data types", - get_name()); + Status status; bool valid = cast_both_types( left_generic, right_generic, result_generic, [&](const auto& left, const auto& right, const auto& res) { @@ -1016,6 +1015,10 @@ public: return false; }); if (!valid) { + if (status.ok()) { + return Status::RuntimeError("{}'s arguments do not match the expected data types", + get_name()); + } return status; }