You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2026/04/03 15:04:32 UTC
(doris) branch branch-4.1 updated: branch-4.1: [fix](variant) preserve subcolumns after row-store partial update #62067 (#62076)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new c551f395d87 branch-4.1: [fix](variant) preserve subcolumns after row-store partial update #62067 (#62076)
c551f395d87 is described below
commit c551f395d87dd1ba509138fdb21028470d835cf6
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Fri Apr 3 23:04:24 2026 +0800
branch-4.1: [fix](variant) preserve subcolumns after row-store partial update #62067 (#62076)
Cherry-picked from #62067
Co-authored-by: lihangyu <li...@selectdb.com>
---
be/src/storage/segment/segment_writer.cpp | 5 +++
be/src/storage/segment/vertical_segment_writer.cpp | 5 +++
.../suites/variant_p0/delete_update.groovy | 40 ++++++++++++++++++++++
3 files changed, 50 insertions(+)
diff --git a/be/src/storage/segment/segment_writer.cpp b/be/src/storage/segment/segment_writer.cpp
index deef80e8e20..976ab0c2e2e 100644
--- a/be/src/storage/segment/segment_writer.cpp
+++ b/be/src/storage/segment/segment_writer.cpp
@@ -630,6 +630,11 @@ Status SegmentWriter::append_block_with_partial_content(const Block* block, size
use_default_or_null_flag, has_default_or_nullable,
cast_set<uint32_t>(segment_start_pos), block));
+ if (_tablet_schema->num_variant_columns() > 0) {
+ RETURN_IF_ERROR(variant_util::parse_and_materialize_variant_columns(
+ full_block, *_tablet_schema, missing_cids));
+ }
+
// convert block to row store format
_serialize_block_to_row_column(full_block);
diff --git a/be/src/storage/segment/vertical_segment_writer.cpp b/be/src/storage/segment/vertical_segment_writer.cpp
index a3728111fa2..c9ac91128a9 100644
--- a/be/src/storage/segment/vertical_segment_writer.cpp
+++ b/be/src/storage/segment/vertical_segment_writer.cpp
@@ -637,6 +637,11 @@ Status VerticalSegmentWriter::_append_block_with_partial_content(RowsInBlock& da
_opts.rowset_ctx, _rsid_to_rowset, *_tablet_schema, full_block,
use_default_or_null_flag, has_default_or_nullable, segment_start_pos, data.block));
+ if (_tablet_schema->num_variant_columns() > 0) {
+ RETURN_IF_ERROR(variant_util::parse_and_materialize_variant_columns(
+ full_block, *_tablet_schema, _opts.rowset_ctx->partial_update_info->missing_cids));
+ }
+
// row column should be filled here
// convert block to row store format
_serialize_block_to_row_column(full_block);
diff --git a/regression-test/suites/variant_p0/delete_update.groovy b/regression-test/suites/variant_p0/delete_update.groovy
index 7d01312953d..49ed6ab5ae6 100644
--- a/regression-test/suites/variant_p0/delete_update.groovy
+++ b/regression-test/suites/variant_p0/delete_update.groovy
@@ -73,6 +73,46 @@ suite("regression_test_variant_delete_and_update", "variant_type"){
sql """delete from ${table_name} where vs = 'xxx' or vs = 'yyy'"""
qt_sql "select * from ${table_name} order by k"
+ def partialUpdateVariantTable = "var_partial_update_keep_subcolumn"
+ sql "DROP TABLE IF EXISTS ${partialUpdateVariantTable}"
+ sql """
+ CREATE TABLE IF NOT EXISTS ${partialUpdateVariantTable} (
+ event_id bigint,
+ oneid string,
+ event_property_variant variant
+ )
+ UNIQUE KEY(`event_id`)
+ DISTRIBUTED BY HASH(event_id) BUCKETS 1
+ properties(
+ "replication_num" = "1",
+ "enable_unique_key_merge_on_write" = "true",
+ "store_row_column" = "true"
+ );
+ """
+ sql """insert into ${partialUpdateVariantTable} values
+ (1, 'old-oneid', '{"base_id":"100000000009523363","other_key":"abc"}')"""
+ sql "sync"
+
+ def beforeUpdate = sql """select cast(event_property_variant['base_id'] as string)
+ from ${partialUpdateVariantTable}
+ where event_id = 1"""
+ assertEquals("100000000009523363", beforeUpdate[0][0])
+
+ sql """update ${partialUpdateVariantTable}
+ set oneid = 'new-oneid'
+ where event_id = 1"""
+ sql "sync"
+
+ def afterUpdate = sql """select cast(event_property_variant['base_id'] as string)
+ from ${partialUpdateVariantTable}
+ where event_id = 1"""
+ assertEquals("100000000009523363", afterUpdate[0][0])
+
+ def wholeVariant = sql """select cast(event_property_variant as string)
+ from ${partialUpdateVariantTable}
+ where event_id = 1"""
+ assertEquals('{"base_id":"100000000009523363","other_key":"abc"}', wholeVariant[0][0])
+
// delete & insert concurrently
sql "set enable_unique_key_partial_update=true;"
sql "sync"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org