wangbo commented on code in PR #9500:
URL: https://github.com/apache/incubator-doris/pull/9500#discussion_r870050224
##########
be/src/vec/columns/predicate_column.h:
##########
@@ -230,17 +230,36 @@ class PredicateColumnType final : public
COWHelper<IColumn, PredicateColumnType<
void insert_many_binary_data(char* data_array, uint32_t* len_array,
uint32_t* start_offset_array, size_t num)
override {
if constexpr (std::is_same_v<T, StringValue>) {
+ if (!_is_mem_pool_inited) {
+ _pool.reset(new MemPool("PredicateStringColumn"));
+ _is_mem_pool_inited = true;
+ }
+
+ size_t total_mem_size = 0;
+ for (size_t i = 0; i < num; i++) {
+ total_mem_size += len_array[i];
+ }
+
+ char* destination = (char*)_pool->allocate(total_mem_size);
for (size_t i = 0; i < num; i++) {
uint32_t len = len_array[i];
uint32_t start_offset = start_offset_array[i];
- insert_string_value(data_array + start_offset, len);
+ memcpy(destination, data_array + start_offset, len);
+ StringValue sv(destination, len);
+ data.push_back_without_reserve(sv);
+ destination += len;
}
}
}
void insert_default() override { data.push_back(T()); }
- void clear() override { data.clear(); }
+ void clear() override {
+ data.clear();
+ if (_is_mem_pool_inited) {
Review Comment:
This is just for memory reuse.
```
mem_pool.h
/// Makes all allocated chunks available for re-use, but doesn't delete
any chunks.
void clear();
```
--
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]