From 400c9c8b62fa49f541bb56dc3578aeaf926ecb9d Mon Sep 17 00:00:00 2001 From: ZHAO Chun Date: Tue, 19 Feb 2019 12:26:23 +0800 Subject: [PATCH] Support grayscale release (#641) --- be/src/runtime/user_function_cache.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/user_function_cache.cpp b/be/src/runtime/user_function_cache.cpp index cc3e3bba08..fc6001aa9a 100644 --- a/be/src/runtime/user_function_cache.cpp +++ b/be/src/runtime/user_function_cache.cpp @@ -18,6 +18,7 @@ #include "runtime/user_function_cache.h" #include +#include #include // boost::split #include // boost::algorithm::ends_with @@ -169,13 +170,22 @@ Status UserFunctionCache::_load_cached_lib() { return Status::OK; } +std::string get_real_symbol(const std::string& symbol) { + static std::regex rx1("8palo_udf"); + std::string str1 = std::regex_replace(symbol, rx1, "9doris_udf"); + static std::regex rx2("4palo"); + std::string str2 = std::regex_replace(str1, rx2, "5doris"); + return str2; +} + Status UserFunctionCache::get_function_ptr( int64_t fid, - const std::string& symbol, + const std::string& orig_symbol, const std::string& url, const std::string& checksum, void** fn_ptr, UserFunctionCacheEntry** output_entry) { + auto symbol = get_real_symbol(orig_symbol); if (fid == 0) { // Just loading a function ptr in the current process. No need to take any locks. RETURN_IF_ERROR(dynamic_lookup(_current_process_handle, symbol.c_str(), fn_ptr));