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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new a127aa1fa85 branch-3.0-pick: [Fix](partial update) use correct default 
value for missing columns in partial update (#49066) (#49221)
a127aa1fa85 is described below

commit a127aa1fa85dca0d57f19d7946b62f11289bba32
Author: bobhan1 <bao...@selectdb.com>
AuthorDate: Wed Mar 19 19:53:39 2025 +0800

    branch-3.0-pick: [Fix](partial update) use correct default value for 
missing columns in partial update (#49066) (#49221)
    
    pick https://github.com/apache/doris/pull/49066
---
 be/src/olap/base_tablet.cpp                        |   2 +-
 be/src/olap/partial_update_info.cpp                |   2 +-
 .../test_partial_update_complex_type.out           | Bin 1855 -> 2735 bytes
 .../test_partial_update_complex_type.groovy        |  35 ++++++++++++++++++---
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/be/src/olap/base_tablet.cpp b/be/src/olap/base_tablet.cpp
index 0aa07572704..4250a9f09b8 100644
--- a/be/src/olap/base_tablet.cpp
+++ b/be/src/olap/base_tablet.cpp
@@ -1016,7 +1016,7 @@ Status BaseTablet::generate_new_block_for_partial_update(
                             mutable_column.get())
                             ->insert_null_elements(1);
                 } else {
-                    mutable_column->insert_default();
+                    
mutable_column->insert(rs_column.get_vec_type()->get_default());
                 }
             } else {
                 mutable_column->insert_from(
diff --git a/be/src/olap/partial_update_info.cpp 
b/be/src/olap/partial_update_info.cpp
index 5ab08b012f1..94dd4673f59 100644
--- a/be/src/olap/partial_update_info.cpp
+++ b/be/src/olap/partial_update_info.cpp
@@ -339,7 +339,7 @@ Status PartialUpdateReadPlan::fill_missing_columns(
                     // If the control flow reaches this branch, the column 
neither has default value
                     // nor is nullable. It means that the row's delete sign is 
marked, and the value
                     // columns are useless and won't be read. So we can just 
put arbitary values in the cells
-                    missing_col->insert_default();
+                    
missing_col->insert(tablet_column.get_vec_type()->get_default());
                 }
                 // clang-format on
             }
diff --git 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
index ae7ed3b79b9..6f6a385a359 100644
Binary files 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
 and 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
 differ
diff --git 
a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_complex_type.groovy
 
b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_complex_type.groovy
index ebd32310fd2..fc3cb097080 100644
--- 
a/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_complex_type.groovy
+++ 
b/regression-test/suites/unique_with_mow_p0/partial_update/test_partial_update_complex_type.groovy
@@ -1,4 +1,3 @@
-
 // Licensed to the Apache Software Foundation (ASF) under one
 // or more contributor license agreements.  See the NOTICE file
 // distributed with this work for additional information
@@ -32,7 +31,7 @@ suite("test_primary_key_partial_update_complex_type", "p0") {
             // 2. the combination of map type and row store may result in 
bugs, so we skip map type in temporary
             //
             // create table
-            sql """ DROP TABLE IF EXISTS ${tableName} """
+            sql """ DROP TABLE IF EXISTS ${tableName} FORCE"""
             sql """ CREATE TABLE ${tableName} (
                         `id` int(11) NOT NULL COMMENT "用户 ID",
                         `c_varchar` varchar(65533) NULL COMMENT "用户姓名",
@@ -120,8 +119,36 @@ suite("test_primary_key_partial_update_complex_type", 
"p0") {
                 select * from ${tableName} order by id;
             """
 
-            // drop table
-            sql """ DROP TABLE IF EXISTS ${tableName} """
+            // create table for NOT NULL tests
+            def tableName2 = "${tableName}_not_null"
+            sql """ DROP TABLE IF EXISTS ${tableName2} FORCE"""
+            sql """ CREATE TABLE ${tableName2} (
+                        `id` int(11) NOT NULL COMMENT "用户 ID",
+                        `c_varchar` varchar(65533) NULL COMMENT "用户姓名",
+                        `c_jsonb` JSONB NOT NULL,
+                        `c_array` ARRAY<INT> NOT NULL,
+                        `c_struct` STRUCT<a:INT, b:INT> NOT NULL,
+                        `c_map` MAP<STRING,int> not null)
+                        UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 1
+                        PROPERTIES("replication_num" = "1", 
"enable_unique_key_merge_on_write" = "true",
+                        "store_row_column" = "${use_row_store}"); """
+
+            sql """insert into ${tableName2} values(2, "doris2", '{"jsonk2": 
333, "jsonk4": 444}', [300, 400], {3, 4}, {'a': 2})"""
+            sql """insert into ${tableName2} values(1, "doris1", '{"jsonk1": 
123, "jsonk2": 456}', [100, 200], {1, 2}, {'b': 3})"""
+            sql """insert into ${tableName2} values(3, "doris3", '{"jsonk3": 
456, "jsonk5": 789}', [600, 400], {2, 7}, {'cccc': 10})"""
+            String sql1 = "delete from ${tableName2} where id<=2;"
+            explain {
+                sql sql1
+                contains "IS_PARTIAL_UPDATE: true"
+            }
+            sql(sql1)
+
+            qt_sql """ select *,__DORIS_VERSION_COL__,__DORIS_DELETE_SIGN__ 
from ${tableName2} order by id,__DORIS_VERSION_COL__;"""
+            sql "set skip_delete_bitmap=true;"
+            sql "set skip_delete_sign=true;"
+            qt_sql """ select *,__DORIS_VERSION_COL__,__DORIS_DELETE_SIGN__ 
from ${tableName2} order by id,__DORIS_VERSION_COL__;"""
+            sql "set skip_delete_bitmap=false;"
+            sql "set skip_delete_sign=false;"
         }
     }
 }


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

Reply via email to