[Bug](javaudf) fix BE crash if javaudf is push down (#21139)

This commit is contained in:
Gabriel
2023-06-28 15:01:24 +08:00
committed by GitHub
parent 1fc1e76fc7
commit a4fdf7324a
6 changed files with 177 additions and 141 deletions

View File

@ -90,16 +90,20 @@ FunctionRPC::FunctionRPC(const TFunction& fn, const DataTypes& argument_types,
: _argument_types(argument_types), _return_type(return_type), _tfn(fn) {}
Status FunctionRPC::open(FunctionContext* context, FunctionContext::FunctionStateScope scope) {
_fn = std::make_unique<RPCFnImpl>(_tfn);
if (!_fn->available()) {
return Status::InternalError("rpc env init error");
if (scope == FunctionContext::FRAGMENT_LOCAL) {
std::shared_ptr<RPCFnImpl> fn = std::make_shared<RPCFnImpl>(_tfn);
if (!fn->available()) {
return Status::InternalError("rpc env init error");
}
context->set_function_state(FunctionContext::FRAGMENT_LOCAL, fn);
}
return Status::OK();
}
Status FunctionRPC::execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count, bool dry_run) {
return _fn->vec_call(context, block, arguments, result, input_rows_count);
RPCFnImpl* fn = reinterpret_cast<RPCFnImpl*>(
context->get_function_state(FunctionContext::FRAGMENT_LOCAL));
return fn->vec_call(context, block, arguments, result, input_rows_count);
}
} // namespace doris::vectorized