This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 63fb74b4809 branch-2.1: [Bug](udf) should delete local ref when return error msg #48609 (#49528) 63fb74b4809 is described below commit 63fb74b480978d4db9a16f74b5da0ccf3e39560a Author: zhangstar333 <zhangs...@selectdb.com> AuthorDate: Fri Mar 28 09:57:18 2025 +0800 branch-2.1: [Bug](udf) should delete local ref when return error msg #48609 (#49528) Problem Summary: cherry-pick from master (#48609) --- .../vec/aggregate_functions/aggregate_function_java_udaf.h | 13 ++++--------- be/src/vec/functions/function_java_udf.cpp | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h b/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h index 44f1889efd3..7740c809dec 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h +++ b/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h @@ -203,9 +203,8 @@ public: jobject output_map = JniUtil::convert_to_java_map(env, output_params); long output_address = env->CallLongMethod(executor_obj, executor_get_value_id, place, output_map); - RETURN_IF_ERROR(JniUtil::GetJniExceptionMsg(env)); env->DeleteLocalRef(output_map); - + RETURN_IF_ERROR(JniUtil::GetJniExceptionMsg(env)); return JniConnector::fill_block(&output_block, {0}, output_address); } @@ -288,16 +287,12 @@ public: void create(AggregateDataPtr __restrict place) const override { new (place) Data(argument_types.size()); if (_first_created) { - Status status = Status::OK(); - SAFE_CREATE(RETURN_IF_STATUS_ERROR(status, - this->data(place).init_udaf(_fn, _local_location)), - { - static_cast<void>(this->data(place).destroy()); - this->data(place).~Data(); - }); + Status status = this->data(place).init_udaf(_fn, _local_location); _first_created = false; _exec_place = place; if (UNLIKELY(!status.ok())) { + static_cast<void>(this->data(place).destroy()); + this->data(place).~Data(); throw doris::Exception(ErrorCode::INTERNAL_ERROR, status.to_string()); } } diff --git a/be/src/vec/functions/function_java_udf.cpp b/be/src/vec/functions/function_java_udf.cpp index 63985f1964c..cff050794ff 100644 --- a/be/src/vec/functions/function_java_udf.cpp +++ b/be/src/vec/functions/function_java_udf.cpp @@ -114,10 +114,9 @@ Status JavaFunctionCall::execute_impl(FunctionContext* context, Block& block, jobject output_map = JniUtil::convert_to_java_map(env, output_params); long output_address = env->CallLongMethod(jni_ctx->executor, jni_ctx->executor_evaluate_id, input_map, output_map); - RETURN_IF_ERROR(JniUtil::GetJniExceptionMsg(env)); env->DeleteLocalRef(input_map); env->DeleteLocalRef(output_map); - + RETURN_IF_ERROR(JniUtil::GetJniExceptionMsg(env)); return JniConnector::fill_block(&block, {result}, output_address); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org