This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 17d1c1bc7f [enhancement](memory) PODArray replaces MemPool in
PredicateColumn (#17800)
17d1c1bc7f is described below
commit 17d1c1bc7f6cc95eecd224eaa219c976b60fa17e
Author: Xinyi Zou <[email protected]>
AuthorDate: Thu Mar 16 09:01:28 2023 +0800
[enhancement](memory) PODArray replaces MemPool in PredicateColumn (#17800)
MemPool is about to be removed, replaced by Arena and PODArray.
---
be/src/vec/columns/predicate_column.h | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/be/src/vec/columns/predicate_column.h
b/be/src/vec/columns/predicate_column.h
index f67909889f..aa381b61bd 100644
--- a/be/src/vec/columns/predicate_column.h
+++ b/be/src/vec/columns/predicate_column.h
@@ -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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]