This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 44273086afb Revert "[chore](function) function catch std:: exception" (#53907) 44273086afb is described below commit 44273086afb36b7588584e1d9ed6d8890c7735c4 Author: Mryange <2319153...@qq.com> AuthorDate: Sat Jul 26 19:19:59 2025 +0800 Revert "[chore](function) function catch std:: exception" (#53907) Reverts apache/doris#53041 --- be/src/vec/functions/function.h | 9 ++--- .../vec/function/function_throw_exception_test.cpp | 39 ---------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/be/src/vec/functions/function.h b/be/src/vec/functions/function.h index 0d8e72ec08a..d8385b484e9 100644 --- a/be/src/vec/functions/function.h +++ b/be/src/vec/functions/function.h @@ -190,13 +190,8 @@ public: try { return prepare(context, block, arguments, result) ->execute(context, block, arguments, result, input_rows_count, dry_run); - } catch (const std::exception& e) { - if (const auto* doris_e = dynamic_cast<const doris::Exception*>(&e)) { - return doris_e->to_status(); - } else { - return Status::InternalError("Function {} execute failed: {}", get_name(), - e.what()); - } + } catch (const Exception& e) { + return e.to_status(); } } diff --git a/be/test/vec/function/function_throw_exception_test.cpp b/be/test/vec/function/function_throw_exception_test.cpp index 898121a2c81..3239e53c4a0 100644 --- a/be/test/vec/function/function_throw_exception_test.cpp +++ b/be/test/vec/function/function_throw_exception_test.cpp @@ -17,8 +17,6 @@ #include <gtest/gtest.h> -#include <stdexcept> - #include "runtime/primitive_type.h" #include "vec/data_types/data_type_number.h" #include "vec/functions/function.h" @@ -48,31 +46,8 @@ public: } }; -class MockFunctionThrowStdException : public IFunction { -public: - static constexpr auto name = "mock_function_throw_stdexception"; - static FunctionPtr create() { return std::make_shared<MockFunctionThrowStdException>(); } - String get_name() const override { return name; } - bool skip_return_type_check() const override { return true; } - bool use_default_implementation_for_constants() const override { return false; } - - size_t get_number_of_arguments() const override { return 0; } - - bool is_variadic() const override { return true; } - - DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { - return std::make_shared<DataTypeFloat64>(); - } - - Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, - uint32_t result, size_t input_rows_count) const override { - throw std::runtime_error("BEUT TEST: MockFunctionThrowStdException"); - } -}; - void register_function_throw_exception(SimpleFunctionFactory& factory) { factory.register_function<MockFunctionThrowException>(); - factory.register_function<MockFunctionThrowStdException>(); } TEST(FunctionThrowExceptionTest, test_throw_exception) { @@ -86,18 +61,4 @@ TEST(FunctionThrowExceptionTest, test_throw_exception) { EXPECT_EQ(st.code(), ErrorCode::INTERNAL_ERROR); EXPECT_EQ(st.msg(), "BEUT TEST: MockFunctionThrowException"); } - -TEST(FunctionThrowExceptionTest, test_throw_std_exception) { - auto function = SimpleFunctionFactory::instance().get_function( - "mock_function_throw_stdexception", {}, std::make_shared<DataTypeFloat64>(), {false}, - BeExecVersionManager::get_newest_version()); - - Block block; - auto st = function->execute(nullptr, block, {}, 0, 1); - - EXPECT_EQ(st.code(), ErrorCode::INTERNAL_ERROR); - EXPECT_EQ(st.msg(), - "Function mock_function_throw_stdexception execute failed: BEUT TEST: " - "MockFunctionThrowStdException"); -} } // namespace doris::vectorized \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org