[fix](function) bad performance caused by creating Status::RuntimeError (#28362)

This commit is contained in:
Jerry Hu
2023-12-14 09:29:22 +08:00
committed by GitHub
parent e5be751697
commit 1901f0f35b

View File

@ -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;
}