Skip to content

Commit

Permalink
fix: create function (#3441)
Browse files Browse the repository at this point in the history
  • Loading branch information
dl239 committed Sep 19, 2023
1 parent 1cb6184 commit eff3045
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/cmd/single_tablet_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST_P(DBSDKTest, CreateFunction) {
sr = cli->sr;
::openmldb::sdk::SQLClusterRouter* sr_2 = nullptr;
if (cs->IsClusterMode()) {
::openmldb::sdk::ClusterOptions copt;
::openmldb::sdk::ClusterOptions copt;
copt.zk_cluster = mc.GetZkCluster();
copt.zk_path = mc.GetZkPath();
auto cur_cs = new ::openmldb::sdk::ClusterSDK(copt);
Expand All @@ -75,6 +75,10 @@ TEST_P(DBSDKTest, CreateFunction) {
ProcessSQLs(sr_2, {"set @@execute_mode = 'online'"});
}
hybridse::sdk::Status status;
std::string err_cut2_sql = absl::StrCat("CREATE FUNCTION cut2(x STRING) RETURNS STRING "
"OPTIONS (FILE='libnotfound_udf.so');");
sr->ExecuteSQL(err_cut2_sql, &status);
ASSERT_FALSE(status.IsOK());
std::string so_path = openmldb::test::GetParentDir(openmldb::test::GetExeDir()) + "/libtest_udf.so";
std::string cut2_sql = absl::StrCat("CREATE FUNCTION cut2(x STRING) RETURNS STRING "
"OPTIONS (FILE='", so_path, "');");
Expand Down
3 changes: 2 additions & 1 deletion src/nameserver/name_server_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9735,8 +9735,9 @@ void NameServerImpl::CreateFunction(RpcController* controller, const CreateFunct
std::string msg;
if (!tablet->client_->CreateFunction(request->fun(), &msg)) {
error_msgs.append("create function failed on " + tablet->client_->GetEndpoint() + ", reason: " + msg + ";");
} else {
succ_tablets.emplace_back(tablet);
}
succ_tablets.emplace_back(tablet);
}
// rollback and return, it's ok if tablet rollback failed
if (succ_tablets.size() < tablets.size()) {
Expand Down

0 comments on commit eff3045

Please sign in to comment.