wangbo commented on a change in pull request #8627: URL: https://github.com/apache/incubator-doris/pull/8627#discussion_r834945796
########## File path: be/src/vec/columns/column_dictionary.h ########## @@ -242,18 +213,73 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { const StringRef* dict_array, size_t data_num, uint32_t dict_num) override { if (!is_dict_inited()) { - dict.reserve(dict_num); + _dict.reserve(dict_num); for (uint32_t i = 0; i < dict_num; ++i) { auto value = StringValue(dict_array[i].data, dict_array[i].size); - dict.insert_value(value); + _dict.insert_value(value); } _dict_inited = true; } - char* end_ptr = (char*)codes.get_end_ptr(); + char* end_ptr = (char*)_codes.get_end_ptr(); memcpy(end_ptr, data_array + start_index, data_num * sizeof(T)); end_ptr += data_num * sizeof(T); - codes.set_end_ptr(end_ptr); + _codes.set_end_ptr(end_ptr); + } + + void convert_dict_codes_if_necessary() override { + if (!is_dict_sorted()) { + _dict.sort(); + _dict_sorted = true; + } + + if (!is_dict_code_converted()) { + for (size_t i = 0; i < size(); ++i) { + _codes[i] = _dict.convert_code(_codes[i]); + } + _dict_code_converted = true; + } + } + + void set_predicate_dict_code_if_necessary(doris::ColumnPredicate* predicate) override { + switch (predicate->type()) { + case PredicateType::EQ: Review comment: Can we move this logic to ColumnPredicate? I think maybe we can using ColumnPredicate's different implementation to different case instead of a runtime switch. -- 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