cambyzju commented on code in PR #46405:
URL: https://github.com/apache/doris/pull/46405#discussion_r1903604777


##########
be/src/vec/functions/function_string.h:
##########
@@ -3770,9 +3770,10 @@ class FunctionConvertTo : public IFunction {
         auto& res_offset = col_res->get_offsets();
         auto& res_chars = col_res->get_chars();
         res_offset.resize(input_rows_count);
-        // max pinyin size is 6, double of utf8 chinese word 3, add one char 
to set '~'
-        ColumnString::check_chars_length(str_chars.size() * 2 + 
input_rows_count, 0);
-        res_chars.resize(str_chars.size() * 2 + input_rows_count);
+        // max pinyin size is 6 + 1 (first '~') for utf8 chinese word 3
+        size_t pinyin_size = (str_chars.size() + 2) / 3 * 7;

Review Comment:
   pinyin_size = chars_size / 3 * 7
   
   but we know 1/3=0, 2/3=0, so we need: (chars_size + (3-1)) / 3 * 7



-- 
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