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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 9a889ecc349 [fix](short circurt) fix return default value issue #34186 
(#36570)
9a889ecc349 is described below

commit 9a889ecc349439f9eb00edd31f931463a29af666
Author: lw112 <131352377+felixw...@users.noreply.github.com>
AuthorDate: Thu Jun 20 17:48:51 2024 +0800

    [fix](short circurt) fix return default value issue #34186 (#36570)
---
 .../vec/data_types/serde/data_type_nullable_serde.cpp |  10 +++++-----
 .../test_compaction_uniq_keys_row_store.out           |   8 ++++----
 .../compaction/test_vertical_compaction_agg_keys.out  |   1 +
 .../compaction/test_vertical_compaction_uniq_keys.out |   1 +
 .../insert_into_table/partial_update_seq_col.out      | Bin 1412 -> 1416 bytes
 regression-test/data/point_query_p0/test_rowstore.out |   6 ++++++
 .../test_partial_update_insert_seq_col.out            | Bin 1412 -> 1416 bytes
 .../partial_update/test_partial_update_seq_col.out    | Bin 1411 -> 1415 bytes
 .../test_partial_update_seq_col_delete.out            | Bin 1526 -> 1530 bytes
 .../suites/point_query_p0/test_rowstore.groovy        |   9 +++++++++
 10 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/be/src/vec/data_types/serde/data_type_nullable_serde.cpp 
b/be/src/vec/data_types/serde/data_type_nullable_serde.cpp
index b96ef441026..d87ca7afff4 100644
--- a/be/src/vec/data_types/serde/data_type_nullable_serde.cpp
+++ b/be/src/vec/data_types/serde/data_type_nullable_serde.cpp
@@ -225,13 +225,13 @@ void DataTypeNullableSerDe::write_one_cell_to_jsonb(const 
IColumn& column, Jsonb
                                                     Arena* mem_pool, int32_t 
col_id,
                                                     int row_num) const {
     auto& nullable_col = assert_cast<const ColumnNullable&>(column);
+    result.writeKey(col_id);
     if (nullable_col.is_null_at(row_num)) {
-        // do not insert to jsonb
-        return;
+        result.writeNull();
+    } else {
+        
nested_serde->write_one_cell_to_jsonb(nullable_col.get_nested_column(), result, 
mem_pool,
+                                              col_id, row_num);
     }
-    result.writeKey(col_id);
-    nested_serde->write_one_cell_to_jsonb(nullable_col.get_nested_column(), 
result, mem_pool,
-                                          col_id, row_num);
 }
 
 void DataTypeNullableSerDe::read_one_cell_from_jsonb(IColumn& column, const 
JsonbValue* arg) const {
diff --git 
a/regression-test/data/compaction/test_compaction_uniq_keys_row_store.out 
b/regression-test/data/compaction/test_compaction_uniq_keys_row_store.out
index cedf0dbe9bd..7c163c62d33 100644
--- a/regression-test/data/compaction/test_compaction_uniq_keys_row_store.out
+++ b/regression-test/data/compaction/test_compaction_uniq_keys_row_store.out
@@ -18,10 +18,10 @@
 3      2017-10-01      2017-10-01      2017-10-01T11:11:11.026 
2017-10-01T11:11:11.016 Beijing 10      1       2020-01-04T00:00        
2020-01-04T00:00        2017-10-01T11:11:11.110 2017-10-01T11:11:11.150111      
2020-01-04T00:00        1       33      21
 
 -- !point_select --
-3      2017-10-01      2017-10-01      2017-10-01T11:11:11.027 
2017-10-01T11:11:11.017 Beijing 10      1       1970-01-01T00:00        
1970-01-01T00:00        1970-01-01T00:00:00.111 1970-01-01T00:00        
2020-01-05T00:00        1       34      20
+3      2017-10-01      2017-10-01      2017-10-01T11:11:11.027 
2017-10-01T11:11:11.017 Beijing 10      1       \N      \N      \N      \N      
2020-01-05T00:00        1       34      20
 
 -- !point_select --
-4      2017-10-01      2017-10-01      2017-10-01T11:11:11.028 
2017-10-01T11:11:11.018 Beijing 10      1       1970-01-01T00:00        
1970-01-01T00:00        1970-01-01T00:00:00.111 1970-01-01T00:00        
2020-01-05T00:00        1       34      20
+4      2017-10-01      2017-10-01      2017-10-01T11:11:11.028 
2017-10-01T11:11:11.018 Beijing 10      1       \N      \N      \N      \N      
2020-01-05T00:00        1       34      20
 
 -- !point_select --
 1      2017-10-01      2017-10-01      2017-10-01T11:11:11.021 
2017-10-01T11:11:11.011 Beijing 10      1       2020-01-01T00:00        
2020-01-01T00:00        2017-10-01T11:11:11.170 2017-10-01T11:11:11.110111      
2020-01-01T00:00        1       30      20
@@ -42,8 +42,8 @@
 3      2017-10-01      2017-10-01      2017-10-01T11:11:11.026 
2017-10-01T11:11:11.016 Beijing 10      1       2020-01-04T00:00        
2020-01-04T00:00        2017-10-01T11:11:11.110 2017-10-01T11:11:11.150111      
2020-01-04T00:00        1       33      21
 
 -- !point_select --
-3      2017-10-01      2017-10-01      2017-10-01T11:11:11.027 
2017-10-01T11:11:11.017 Beijing 10      1       1970-01-01T00:00        
1970-01-01T00:00        1970-01-01T00:00:00.111 1970-01-01T00:00        
2020-01-05T00:00        1       34      20
+3      2017-10-01      2017-10-01      2017-10-01T11:11:11.027 
2017-10-01T11:11:11.017 Beijing 10      1       \N      \N      \N      \N      
2020-01-05T00:00        1       34      20
 
 -- !point_select --
-4      2017-10-01      2017-10-01      2017-10-01T11:11:11.028 
2017-10-01T11:11:11.018 Beijing 10      1       1970-01-01T00:00        
1970-01-01T00:00        1970-01-01T00:00:00.111 1970-01-01T00:00        
2020-01-05T00:00        1       34      20
+4      2017-10-01      2017-10-01      2017-10-01T11:11:11.028 
2017-10-01T11:11:11.018 Beijing 10      1       \N      \N      \N      \N      
2020-01-05T00:00        1       34      20
 
diff --git 
a/regression-test/data/compaction/test_vertical_compaction_agg_keys.out 
b/regression-test/data/compaction/test_vertical_compaction_agg_keys.out
index b4db7b90f74..4a6cbed6a7a 100644
--- a/regression-test/data/compaction/test_vertical_compaction_agg_keys.out
+++ b/regression-test/data/compaction/test_vertical_compaction_agg_keys.out
@@ -14,3 +14,4 @@
 2      2017-10-01      2017-10-01      2017-10-01T11:11:11.110 
2017-10-01T11:11:11.110111      Beijing 10      1       2020-01-03T00:00        
2020-01-03T00:00        2017-10-01T11:11:11.140 2017-10-01T11:11:11.120111      
2020-01-03T00:00        2       32      20      \N      \N
 3      2017-10-01      2017-10-01      2017-10-01T11:11:11.110 
2017-10-01T11:11:11.110111      Beijing 10      1       \N      
2020-01-04T00:00        \N      2017-10-01T11:11:11.150111      
2020-01-05T00:00        3       34      20      \N      \N
 4      2017-10-01      2017-10-01      2017-10-01T11:11:11.110 
2017-10-01T11:11:11.110111      Beijing 10      1       \N      \N      \N      
\N      2020-01-05T00:00        1       34      20      \N      \N
+
diff --git 
a/regression-test/data/compaction/test_vertical_compaction_uniq_keys.out 
b/regression-test/data/compaction/test_vertical_compaction_uniq_keys.out
index 863a064c640..2a25b4dd268 100644
--- a/regression-test/data/compaction/test_vertical_compaction_uniq_keys.out
+++ b/regression-test/data/compaction/test_vertical_compaction_uniq_keys.out
@@ -14,3 +14,4 @@
 2      2017-10-01      2017-10-01      2017-10-01T11:11:11.110 
2017-10-01T11:11:11.110111      Beijing 10      1       2020-01-03T00:00        
2020-01-03T00:00        2017-10-01T11:11:11.140 2017-10-01T11:11:11.120111      
2020-01-03T00:00        1       32      20
 3      2017-10-01      2017-10-01      2017-10-01T11:11:11.110 
2017-10-01T11:11:11.110111      Beijing 10      1       \N      \N      \N      
\N      2020-01-05T00:00        1       34      20
 4      2017-10-01      2017-10-01      2017-10-01T11:11:11.110 
2017-10-01T11:11:11.110111      Beijing 10      1       \N      \N      \N      
\N      2020-01-05T00:00        1       34      20
+
diff --git 
a/regression-test/data/nereids_p0/insert_into_table/partial_update_seq_col.out 
b/regression-test/data/nereids_p0/insert_into_table/partial_update_seq_col.out
index e836839c72b..269eab9708f 100644
Binary files 
a/regression-test/data/nereids_p0/insert_into_table/partial_update_seq_col.out 
and 
b/regression-test/data/nereids_p0/insert_into_table/partial_update_seq_col.out 
differ
diff --git a/regression-test/data/point_query_p0/test_rowstore.out 
b/regression-test/data/point_query_p0/test_rowstore.out
index b73b91ff8ca..6bb347b4500 100644
--- a/regression-test/data/point_query_p0/test_rowstore.out
+++ b/regression-test/data/point_query_p0/test_rowstore.out
@@ -5,3 +5,9 @@
 -- !sql --
 1      abc     123
 
+-- !sql --
+1      abc     123     1970-01-01T00:00:00.111
+
+-- !sql --
+2      def     456     \N
+
diff --git 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_insert_seq_col.out
 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_insert_seq_col.out
index e836839c72b..269eab9708f 100644
Binary files 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_insert_seq_col.out
 and 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_insert_seq_col.out
 differ
diff --git 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col.out
 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col.out
index f4dde3a0f7a..b1153b70d66 100644
Binary files 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col.out
 and 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col.out
 differ
diff --git 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col_delete.out
 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col_delete.out
index fe5746c41b7..afa7ccfc9bb 100644
Binary files 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col_delete.out
 and 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_seq_col_delete.out
 differ
diff --git a/regression-test/suites/point_query_p0/test_rowstore.groovy 
b/regression-test/suites/point_query_p0/test_rowstore.groovy
index e1284931045..ccfed4bcfd1 100644
--- a/regression-test/suites/point_query_p0/test_rowstore.groovy
+++ b/regression-test/suites/point_query_p0/test_rowstore.groovy
@@ -46,4 +46,13 @@ suite("test_rowstore", "p0") {
          ALTER table ${tableName} ADD COLUMN new_column1 INT default "123";
     """
     qt_sql """select * from ${tableName} where k1 = 1"""
+
+    sql """
+         ALTER table ${tableName} ADD COLUMN new_column2 DATETIMEV2(3) DEFAULT 
"1970-01-01 00:00:00.111";
+    """
+    sleep(1000)
+    qt_sql """select * from ${tableName} where k1 = 1"""
+
+    sql """insert into ${tableName} values (2, 'def', 456, NULL)"""
+    qt_sql """select * from ${tableName} where k1 = 2"""
 }
\ No newline at end of file


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

Reply via email to