This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 5c5dcfda78 Revert "[enhancement](memory) PODArray replaces MemPool in
PredicateColumn (#17800)" (#17910)
5c5dcfda78 is described below
commit 5c5dcfda78d33f98816ba43d6190f361442d32d4
Author: TengJianPing <[email protected]>
AuthorDate: Fri Mar 17 20:50:01 2023 +0800
Revert "[enhancement](memory) PODArray replaces MemPool in PredicateColumn
(#17800)" (#17910)
This reverts commit 17d1c1bc7f6cc95eecd224eaa219c976b60fa17e.
---
be/src/vec/columns/predicate_column.h | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/be/src/vec/columns/predicate_column.h
b/be/src/vec/columns/predicate_column.h
index aa381b61bd..f67909889f 100644
--- a/be/src/vec/columns/predicate_column.h
+++ b/be/src/vec/columns/predicate_column.h
@@ -19,6 +19,7 @@
#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"
@@ -275,9 +276,11 @@ 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];
- strings.resize(strings.size() + total_mem_size);
- char* destination = reinterpret_cast<char*>(strings.data()) +
strings.size();
+ char* destination = (char*)_pool->allocate(total_mem_size);
memcpy(destination, data_ + offsets[0], total_mem_size);
size_t org_elem_num = data.size();
data.resize(org_elem_num + num);
@@ -297,13 +300,16 @@ 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];
}
- strings.resize(strings.size() + total_mem_size);
- char* destination = reinterpret_cast<char*>(strings.data()) +
strings.size();
+ char* destination = (char*)_pool->allocate(total_mem_size);
char* org_dst = destination;
size_t org_elem_num = data.size();
data.resize(org_elem_num + num);
@@ -334,7 +340,9 @@ public:
void clear() override {
data.clear();
- strings.clear();
+ if (_pool != nullptr) {
+ _pool->clear();
+ }
}
size_t byte_size() const override { return data.size() * sizeof(T); }
@@ -539,7 +547,7 @@ public:
private:
Container data;
// manages the memory for slice's data(For string type)
- ColumnString::Chars strings;
+ std::unique_ptr<MemPool> _pool;
};
} // namespace doris::vectorized
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]