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

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

commit ebc8d27be1a36271304f2faeff89ba3d3c969e46
Author: xueweizhang <[email protected]>
AuthorDate: Fri Feb 10 12:21:27 2023 +0800

    [fix-core](block) clear block row_same_bit when block reuse (#16172)
---
 be/src/vec/core/block.h                            |  2 ++
 be/src/vec/exec/scan/vscanner.cpp                  |  3 +++
 .../data/datev2/tpcds_sf1_p1/sql/row_same_bit.out  |  3 +++
 .../datev2/tpcds_sf1_p1/sql/row_same_bit.sql       | 22 ++++++++++++++++++++++
 4 files changed, 30 insertions(+)

diff --git a/be/src/vec/core/block.h b/be/src/vec/core/block.h
index af6f51c67c..7dbba019e0 100644
--- a/be/src/vec/core/block.h
+++ b/be/src/vec/core/block.h
@@ -373,6 +373,8 @@ public:
         return row_same_bit[position];
     }
 
+    void clear_same_bit() { row_same_bit.clear(); }
+
 private:
     void erase_impl(size_t position);
     bool is_column_data_null(const doris::TypeDescriptor& type_desc, const 
StringRef& data_ref,
diff --git a/be/src/vec/exec/scan/vscanner.cpp 
b/be/src/vec/exec/scan/vscanner.cpp
index 071509f6ef..e0a5814df6 100644
--- a/be/src/vec/exec/scan/vscanner.cpp
+++ b/be/src/vec/exec/scan/vscanner.cpp
@@ -48,6 +48,9 @@ Status VScanner::get_block(RuntimeState* state, Block* block, 
bool* eof) {
 
     {
         do {
+            // if step 2 filter all rows of block, and block will be reused to 
get next rows,
+            // must clear row_same_bit of block, or will get wrong 
row_same_bit.size() which not equal block.rows()
+            block->clear_same_bit();
             // 1. Get input block from scanner
             {
                 SCOPED_TIMER(_parent->_scan_timer);
diff --git a/regression-test/data/datev2/tpcds_sf1_p1/sql/row_same_bit.out 
b/regression-test/data/datev2/tpcds_sf1_p1/sql/row_same_bit.out
new file mode 100644
index 0000000000..de31c477d9
--- /dev/null
+++ b/regression-test/data/datev2/tpcds_sf1_p1/sql/row_same_bit.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !row_same_bit --
+
diff --git a/regression-test/suites/datev2/tpcds_sf1_p1/sql/row_same_bit.sql 
b/regression-test/suites/datev2/tpcds_sf1_p1/sql/row_same_bit.sql
new file mode 100644
index 0000000000..68ad7e891f
--- /dev/null
+++ b/regression-test/suites/datev2/tpcds_sf1_p1/sql/row_same_bit.sql
@@ -0,0 +1,22 @@
+SELECT
+    coalesce(
+        coalesce(BITMAP_EMPTY(), BITMAP_EMPTY()),
+        CASE
+            WHEN ref_12.`cs_bill_cdemo_sk` IS NOT NULL THEN NULL
+            ELSE NULL
+        END
+    ) AS c0
+FROM
+    regression_test_datev2_tpcds_sf1_p1.catalog_sales AS ref_12
+WHERE
+    BITMAP_SUBSET_IN_RANGE(
+        cast(NULL AS bitmap),
+        cast(
+            BITMAP_MIN(cast(BITMAP_EMPTY() AS bitmap)) AS bigint
+        ),
+        cast(ref_12.`cs_bill_addr_sk` AS bigint)
+    ) IS NOT NULL
+ORDER BY
+    ref_12.`cs_sold_date_sk`
+LIMIT
+    97 OFFSET 125;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to