diff --git a/be/src/vec/columns/predicate_column.h b/be/src/vec/columns/predicate_column.h index 7db73b9d0a3850..eec3f1def7d885 100644 --- a/be/src/vec/columns/predicate_column.h +++ b/be/src/vec/columns/predicate_column.h @@ -230,17 +230,35 @@ class PredicateColumnType final : public COWHelper) { + if (_pool == nullptr) { + _pool.reset(new MemPool("PredicateStringColumn")); + } + + 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 (_pool != nullptr) { + _pool->clear(); + } + } size_t byte_size() const override { return data.size() * sizeof(T); } @@ -410,6 +428,8 @@ class PredicateColumnType final : public COWHelper _pool; }; using ColumnStringValue = PredicateColumnType;