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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit c57dbe33da7370cb1f2cdb0ec5e6a86f798986e1
Author: Gabriel <gabrielleeb...@gmail.com>
AuthorDate: Wed Sep 27 19:41:56 2023 +0800

    [Bug](pipeline) Fix block reusing for union source operator (#24977)
    
    [CANCELLED][INTERNAL_ERROR]Merge block not match, self:[String], 
input:[String, Nullable(String), Nullable(String), Nullable(String), 
Nullable(String), DateV2]
---
 be/src/pipeline/exec/union_source_operator.cpp     |  2 +-
 .../data/nereids_p0/union/test_union.out           |  6 +++
 .../suites/nereids_p0/union/test_union.groovy      | 44 ++++++++++++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/be/src/pipeline/exec/union_source_operator.cpp 
b/be/src/pipeline/exec/union_source_operator.cpp
index f39e0a582b3..ffd8b86384f 100644
--- a/be/src/pipeline/exec/union_source_operator.cpp
+++ b/be/src/pipeline/exec/union_source_operator.cpp
@@ -71,7 +71,7 @@ Status UnionSourceOperator::pull_data(RuntimeState* state, 
vectorized::Block* bl
             return Status::OK();
         }
         block->swap(*output_block);
-        
output_block->clear_column_data(_node->row_desc().num_materialized_slots());
+        
output_block->clear_column_data(_node->intermediate_row_desc().num_materialized_slots());
         _data_queue->push_free_block(std::move(output_block), child_idx);
     }
 
diff --git a/regression-test/data/nereids_p0/union/test_union.out 
b/regression-test/data/nereids_p0/union/test_union.out
index 32e59ccbda9..2fc4cc688dd 100644
--- a/regression-test/data/nereids_p0/union/test_union.out
+++ b/regression-test/data/nereids_p0/union/test_union.out
@@ -364,3 +364,9 @@ hell0
 2016-07-01
 2016-07-02
 
+-- !sql --
+1
+1
+2
+2
+
diff --git a/regression-test/suites/nereids_p0/union/test_union.groovy 
b/regression-test/suites/nereids_p0/union/test_union.groovy
index 9aa8d54c9b3..536e52ba44b 100644
--- a/regression-test/suites/nereids_p0/union/test_union.groovy
+++ b/regression-test/suites/nereids_p0/union/test_union.groovy
@@ -276,4 +276,48 @@ suite("test_union") {
     sql"""drop table ${new_union_table}"""
 
     qt_union35 """select cast("2016-07-01" as date) union (select 
cast("2016-07-02 1:10:0" as date)) order by 1"""
+
+
+    sql """ set batch_size=1; """
+    def tblName1 = "test1"
+    sql """ DROP TABLE IF EXISTS ${tblName1} """
+    sql """
+            CREATE TABLE `${tblName1}` (
+            `a_key` varchar(255) NULL ,
+            `d_key` varchar(255) NULL ,
+            `c_key` varchar(32) NULL
+            ) ENGINE=OLAP
+            UNIQUE KEY(`a_key`, `d_key`, `c_key`)
+            DISTRIBUTED BY HASH(`a_key`, `d_key`, `c_key`) BUCKETS 4
+            PROPERTIES (
+            "replication_allocation" = "tag.location.default: 1",
+            "in_memory" = "false",
+            "storage_format" = "V2",
+            "disable_auto_compaction" = "false"
+            );
+     """
+
+
+     def tblName2 = "test2"
+     sql """ DROP TABLE IF EXISTS ${tblName2} """
+     sql """
+             CREATE TABLE `${tblName2}` (
+             `a_key` varchar(255) NULL ,
+             `d_key` varchar(255) NULL ,
+             `c_key` varchar(32) NULL
+             ) ENGINE=OLAP
+             UNIQUE KEY(`a_key`, `d_key`, `c_key`)
+             DISTRIBUTED BY HASH(`a_key`, `d_key`, `c_key`) BUCKETS 4
+             PROPERTIES (
+             "replication_allocation" = "tag.location.default: 1",
+             "in_memory" = "false",
+             "storage_format" = "V2",
+             "disable_auto_compaction" = "false"
+             );
+      """
+
+      sql """ insert into  ${tblName2} values("1", "2", "3"),("2", "3", "4") 
"""
+      sql """ insert into  ${tblName1} values("1", "2", "3"),("2", "3", "4") 
"""
+
+      qt_sql """ select a_key from (select * from ${tblName1} UNION ALL select 
* from ${tblName2}) t ORDER BY a_key + 1"""
 }


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

Reply via email to