You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/09/22 07:43:32 UTC
[GitHub] [doris] Gabriel39 commented on a diff in pull request #12852: [Improvement](dict) optimize dictionary column
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org