HappenLee commented on code in PR #54553:
URL: https://github.com/apache/doris/pull/54553#discussion_r2268505171


##########
be/src/vec/functions/function_string.h:
##########
@@ -4697,53 +4699,72 @@ class FunctionTranslate : public IFunction {
     template <bool IsConst>
     static void impl_vectors_ascii(const ColumnString* col_source, const 
ColumnString* col_from,
                                    const ColumnString* col_to, ColumnString* 
col_res) {
-        col_res->get_chars().reserve(col_source->get_chars().size());
-        col_res->get_offsets().reserve(col_source->get_offsets().size());
-        std::unordered_map<char, char> translate_map;
+        auto& res_chars = col_res->get_chars();
+        auto& res_offsets = col_res->get_offsets();
+        res_chars.reserve(col_source->get_chars().size());
+        res_offsets.reserve(col_source->get_offsets().size());
+        DCHECK_EQ(col_res->size(), 0);
+        AsciiMap map;
         if (IsConst) {
             const auto& from_str = col_from->get_data_at(0);
             const auto& to_str = col_to->get_data_at(0);
-            translate_map =
-                    build_translate_map_ascii(from_str.to_string_view(), 
to_str.to_string_view());
+            build_translate_map_ascii(map, from_str, to_str);
         }
+

Review Comment:
   if from_str.size == to_str.size we should have a faster dispose way



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to