This is an automated email from the ASF dual-hosted git repository.

yangzhg pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 4f12f84cc3 [bugfix](RemoteUDF) fix remote udf retrun `rpc env init 
error` (#16325)
4f12f84cc3 is described below

commit 4f12f84cc32b2dbf4a631629e948c37d50a606b4
Author: Zhengguo Yang <yangz...@gmail.com>
AuthorDate: Mon Feb 6 15:47:10 2023 +0800

    [bugfix](RemoteUDF) fix remote udf retrun `rpc env init error` (#16325)
---
 be/src/vec/functions/function_rpc.cpp                                | 2 +-
 samples/doris-demo/remote-udf-cpp-demo/cpp_function_service_demo.cpp | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/functions/function_rpc.cpp 
b/be/src/vec/functions/function_rpc.cpp
index 2dfcfce8a7..89131f4b94 100644
--- a/be/src/vec/functions/function_rpc.cpp
+++ b/be/src/vec/functions/function_rpc.cpp
@@ -28,9 +28,9 @@
 namespace doris::vectorized {
 
 RPCFnImpl::RPCFnImpl(const TFunction& fn) : _fn(fn) {
-    _client = 
ExecEnv::GetInstance()->brpc_function_client_cache()->get_client(_server_addr);
     _function_name = _fn.scalar_fn.symbol;
     _server_addr = _fn.hdfs_location;
+    _client = 
ExecEnv::GetInstance()->brpc_function_client_cache()->get_client(_server_addr);
     _signature = fmt::format("{}: [{}/{}]", _fn.name.function_name, 
_fn.hdfs_location,
                              _fn.scalar_fn.symbol);
 }
diff --git 
a/samples/doris-demo/remote-udf-cpp-demo/cpp_function_service_demo.cpp 
b/samples/doris-demo/remote-udf-cpp-demo/cpp_function_service_demo.cpp
index 7e141394d0..2481d36519 100644
--- a/samples/doris-demo/remote-udf-cpp-demo/cpp_function_service_demo.cpp
+++ b/samples/doris-demo/remote-udf-cpp-demo/cpp_function_service_demo.cpp
@@ -32,6 +32,7 @@ public:
                  ::google::protobuf::Closure* done) override {
         brpc::ClosureGuard closure_guard(done);
         std::string fun_name = request->function_name();
+        std::cout << request->DebugString() << std::endl;
         auto* result = response->add_result();
         if (fun_name == "int32_add") {
             result->mutable_type()->set_id(PGenericType::INT32);
@@ -75,6 +76,9 @@ public:
                 result->add_string_value(request->args(0).string_value(i) + " 
+ " +
                                          request->args(1).string_value(i));
             }
+        } else {
+            std::cout << fun_name << " function not supported." << std::endl;
+            response->mutable_result()->Clear();
         }
         response->mutable_status()->set_status_code(0);
         std::cout << response->DebugString();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to