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

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


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new f85b67f98f [fix](function) StringRef should not be key of timezone 
cache (#14729)
f85b67f98f is described below

commit f85b67f98fcafd17b3d835952049096e9d011701
Author: Jerry Hu <[email protected]>
AuthorDate: Fri Dec 2 11:20:08 2022 +0800

    [fix](function) StringRef should not be key of timezone cache (#14729)
---
 be/src/vec/functions/function_convert_tz.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/be/src/vec/functions/function_convert_tz.h 
b/be/src/vec/functions/function_convert_tz.h
index 9d6f1e755d..65a3ced45f 100644
--- a/be/src/vec/functions/function_convert_tz.h
+++ b/be/src/vec/functions/function_convert_tz.h
@@ -26,7 +26,7 @@
 namespace doris::vectorized {
 
 struct ConvertTzCtx {
-    std::map<StringRef, cctz::time_zone> time_zone_cache;
+    std::map<std::string, cctz::time_zone> time_zone_cache;
 };
 class FunctionConvertTZ : public IFunction {
 public:
@@ -102,7 +102,7 @@ private:
                           size_t input_rows_count) {
         auto convert_ctx = reinterpret_cast<ConvertTzCtx*>(
                 
context->get_function_state(FunctionContext::FunctionStateScope::THREAD_LOCAL));
-        std::map<StringRef, cctz::time_zone> time_zone_cache_;
+        std::map<std::string, cctz::time_zone> time_zone_cache_;
         auto& time_zone_cache = convert_ctx ? convert_ctx->time_zone_cache : 
time_zone_cache_;
         for (size_t i = 0; i < input_rows_count; i++) {
             if (result_null_map[i]) {
@@ -110,12 +110,11 @@ private:
                 continue;
             }
 
-            StringRef from_tz = from_tz_column->get_data_at(i);
-            StringRef to_tz = to_tz_column->get_data_at(i);
+            auto from_tz = from_tz_column->get_data_at(i).to_string();
+            auto to_tz = to_tz_column->get_data_at(i).to_string();
 
             if (time_zone_cache.find(from_tz) == time_zone_cache.cend()) {
-                if (!TimezoneUtils::find_cctz_time_zone(from_tz.to_string(),
-                                                        
time_zone_cache[from_tz])) {
+                if (!TimezoneUtils::find_cctz_time_zone(from_tz, 
time_zone_cache[from_tz])) {
                     result_null_map[i] = true;
                     result_column->insert_default();
                     continue;
@@ -123,8 +122,7 @@ private:
             }
 
             if (time_zone_cache.find(to_tz) == time_zone_cache.cend()) {
-                if (!TimezoneUtils::find_cctz_time_zone(to_tz.to_string(),
-                                                        
time_zone_cache[to_tz])) {
+                if (!TimezoneUtils::find_cctz_time_zone(to_tz, 
time_zone_cache[to_tz])) {
                     result_null_map[i] = true;
                     result_column->insert_default();
                     continue;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to