You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/05/12 07:41:46 UTC

[incubator-doris] branch master updated: [fix](storage) fix core for string predicate in storage layer (#9500)

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/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a0b95d8fcb [fix](storage) fix core for string predicate in storage layer (#9500)
a0b95d8fcb is described below

commit a0b95d8fcb29ae8d9f7754824725b3bdbabcb2ac
Author: wangbo <wa...@apache.org>
AuthorDate: Thu May 12 15:41:39 2022 +0800

    [fix](storage) fix core for string predicate in storage layer (#9500)
    
    
    
    Co-authored-by: Wang Bo <wa...@meituan.com>
---
 be/src/vec/columns/predicate_column.h | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/columns/predicate_column.h b/be/src/vec/columns/predicate_column.h
index 7db73b9d0a..eec3f1def7 100644
--- a/be/src/vec/columns/predicate_column.h
+++ b/be/src/vec/columns/predicate_column.h
@@ -230,17 +230,35 @@ public:
     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 (_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 @@ public:
 
 private:
     Container data;
+    // manages the memory for slice's data(For string type)
+    std::unique_ptr<MemPool> _pool;
 };
 using ColumnStringValue = PredicateColumnType<StringValue>;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org