[enhancement](javaudf) not depend on parent will cause deconstructor core (#18948)
Co-authored-by: yiguolei <yiguolei@gmail.com>
This commit is contained in:
@ -96,8 +96,11 @@ private:
|
||||
};
|
||||
|
||||
struct JniContext {
|
||||
JavaFunctionCall* parent = nullptr;
|
||||
|
||||
// Do not save parent directly, because parent is in VExpr, but jni context is in FunctionContext
|
||||
// The deconstruct sequence is not determined, it will core.
|
||||
// JniContext's lifecycle should same with function context, not related with expr
|
||||
jclass executor_cl_;
|
||||
jmethodID executor_close_id_;
|
||||
jobject executor = nullptr;
|
||||
bool is_closed = false;
|
||||
|
||||
@ -120,7 +123,8 @@ private:
|
||||
std::unique_ptr<IntermediateState> output_intermediate_state_ptr;
|
||||
|
||||
JniContext(int64_t num_args, JavaFunctionCall* parent)
|
||||
: parent(parent),
|
||||
: executor_cl_(parent->executor_cl_),
|
||||
executor_close_id_(parent->executor_close_id_),
|
||||
input_values_buffer_ptr(new int64_t[num_args]),
|
||||
input_nulls_buffer_ptr(new int64_t[num_args]),
|
||||
input_offsets_ptrs(new int64_t[num_args]),
|
||||
@ -145,8 +149,7 @@ private:
|
||||
LOG(WARNING) << "errors while get jni env " << status;
|
||||
return;
|
||||
}
|
||||
env->CallNonvirtualVoidMethodA(executor, parent->executor_cl_,
|
||||
parent->executor_close_id_, NULL);
|
||||
env->CallNonvirtualVoidMethodA(executor, executor_cl_, executor_close_id_, NULL);
|
||||
Status s = JniUtil::GetJniExceptionMsg(env);
|
||||
if (!s.ok()) LOG(WARNING) << s;
|
||||
env->DeleteGlobalRef(executor);
|
||||
|
||||
Reference in New Issue
Block a user