This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit 1071148901efe504f25e1f344adcef3c921cbfff
Author: wangbo <wan...@apache.org>
AuthorDate: Wed Mar 16 11:39:41 2022 +0800

    [fix] fix bitmap wrong result (#8478)
    
    Fix a bug when query bitmap return wrong result, even the simplest query.
    Such as
    ```
    CREATE TABLE `pv_bitmap_fix2` (
    `dt` int(11) NULL COMMENT "",
    `page` varchar(10) NULL COMMENT "",
    `user_id_bitmap` bitmap BITMAP_UNION NULL COMMENT ""
    ) ENGINE=OLAP
    AGGREGATE KEY(`dt`, `page`)
    COMMENT "OLAP" DISTRIBUTED BY HASH(`dt`) BUCKETS 2
    PROPERTIES (
    "replication_allocation" = "tag.location.default: 1",
    "in_memory" = "false",
    "storage_format" = "V2"
    )
    
    Insert any hundreds of rows of data
    
    select count(distinct user_id_bitmap) from pv_bitmap_fix2
    
    the result is wrong
    ```
    This is a bug of vectorization of storage layer.
---
 be/src/vec/columns/column_complex.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/columns/column_complex.h 
b/be/src/vec/columns/column_complex.h
index df2b582..a7a87a4 100644
--- a/be/src/vec/columns/column_complex.h
+++ b/be/src/vec/columns/column_complex.h
@@ -63,11 +63,11 @@ public:
     }
 
     void insert_many_binary_data(char* data_array, uint32_t* len_array, 
uint32_t* start_offset_array, size_t num) override {
-        resize(num);
         if constexpr (std::is_same_v<T, BitmapValue>) {
             for (size_t i = 0; i < num; i++) {
                 uint32_t len = len_array[i];
                 uint32_t start_offset = start_offset_array[i];
+                insert_default();
                 BitmapValue* pvalue = &get_element(size() - 1);
                 if (len != 0) {
                     BitmapValue value;
@@ -81,6 +81,7 @@ public:
             for (size_t i = 0; i < num; i++) {
                 uint32_t len = len_array[i];
                 uint32_t start_offset = start_offset_array[i];
+                insert_default();
                 HyperLogLog* pvalue = &get_element(size() - 1);
                 if (len != 0) {
                     HyperLogLog value;

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

Reply via email to