Gabriel39 commented on code in PR #12852:
URL: https://github.com/apache/doris/pull/12852#discussion_r977308937


##########
be/src/vec/columns/column_dictionary.h:
##########
@@ -192,11 +192,13 @@ class ColumnDictionary final : public COWHelper<IColumn, 
ColumnDictionary<T>> {
 
     Status filter_by_selector(const uint16_t* sel, size_t sel_size, IColumn* 
col_ptr) override {
         auto* res_col = reinterpret_cast<vectorized::ColumnString*>(col_ptr);
+        res_col->get_offsets().reserve(sel_size);
+        res_col->get_chars().reserve(_dict.avg_str_len() * sel_size);
         for (size_t i = 0; i < sel_size; i++) {
             uint16_t n = sel[i];
             auto& code = reinterpret_cast<T&>(_codes[n]);
             auto value = _dict.get_value(code);
-            res_col->insert_data(value.ptr, value.len);
+            res_col->insert_data_without_reserve(value.ptr, value.len);

Review Comment:
   If so, `chars` in ColumnString will still to reserve a bigger memory block. 
`_dict.avg_str_len() * sel_size` is just a conservative estimation here. 



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to