[enhancement](memory) PODArray replaces MemPool in PredicateColumn (#17800)
MemPool is about to be removed, replaced by Arena and PODArray.
This commit is contained in:
@ -19,7 +19,6 @@
|
||||
|
||||
#include "olap/decimal12.h"
|
||||
#include "olap/uint24.h"
|
||||
#include "runtime/mem_pool.h"
|
||||
#include "runtime/primitive_type.h"
|
||||
#include "vec/columns/column.h"
|
||||
#include "vec/columns/column_decimal.h"
|
||||
@ -276,11 +275,9 @@ public:
|
||||
return;
|
||||
}
|
||||
if constexpr (std::is_same_v<T, StringRef>) {
|
||||
if (_pool == nullptr) {
|
||||
_pool.reset(new MemPool());
|
||||
}
|
||||
const auto total_mem_size = offsets[num] - offsets[0];
|
||||
char* destination = (char*)_pool->allocate(total_mem_size);
|
||||
strings.resize(strings.size() + total_mem_size);
|
||||
char* destination = reinterpret_cast<char*>(strings.data()) + strings.size();
|
||||
memcpy(destination, data_ + offsets[0], total_mem_size);
|
||||
size_t org_elem_num = data.size();
|
||||
data.resize(org_elem_num + num);
|
||||
@ -300,16 +297,13 @@ public:
|
||||
return;
|
||||
}
|
||||
if constexpr (std::is_same_v<T, StringRef>) {
|
||||
if (_pool == nullptr) {
|
||||
_pool.reset(new MemPool());
|
||||
}
|
||||
|
||||
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);
|
||||
strings.resize(strings.size() + total_mem_size);
|
||||
char* destination = reinterpret_cast<char*>(strings.data()) + strings.size();
|
||||
char* org_dst = destination;
|
||||
size_t org_elem_num = data.size();
|
||||
data.resize(org_elem_num + num);
|
||||
@ -340,9 +334,7 @@ public:
|
||||
|
||||
void clear() override {
|
||||
data.clear();
|
||||
if (_pool != nullptr) {
|
||||
_pool->clear();
|
||||
}
|
||||
strings.clear();
|
||||
}
|
||||
|
||||
size_t byte_size() const override { return data.size() * sizeof(T); }
|
||||
@ -547,7 +539,7 @@ public:
|
||||
private:
|
||||
Container data;
|
||||
// manages the memory for slice's data(For string type)
|
||||
std::unique_ptr<MemPool> _pool;
|
||||
ColumnString::Chars strings;
|
||||
};
|
||||
|
||||
} // namespace doris::vectorized
|
||||
|
||||
Reference in New Issue
Block a user