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

eldenmoon pushed a commit to branch variant-sparse
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/variant-sparse by this push:
     new d1f07347ed4 [fix](tablet schema) fix error copy (#49532)
d1f07347ed4 is described below

commit d1f07347ed4d058be23918e63a13b285f0526ca9
Author: Sun Chenyang <suncheny...@selectdb.com>
AuthorDate: Wed Mar 26 20:48:59 2025 +0800

    [fix](tablet schema) fix error copy (#49532)
---
 be/src/olap/tablet_schema.cpp                      |  14 ++++-
 .../data/variant_p0/variant_with_mow.out           | Bin 0 -> 109 bytes
 .../suites/variant_p0/variant_with_mow.groovy      |  69 +++++++++++++++++++++
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp
index 211761708a0..ad46fe9aeec 100644
--- a/be/src/olap/tablet_schema.cpp
+++ b/be/src/olap/tablet_schema.cpp
@@ -1100,6 +1100,10 @@ void TabletSchema::shawdow_copy_without_columns(const 
TabletSchema& tablet_schem
     _num_key_columns = 0;
     _cols.clear();
     _vl_field_mem_size = 0;
+    _delete_sign_idx = -1;
+    _sequence_col_idx = -1;
+    _version_col_idx = -1;
+    _skip_bitmap_col_idx = -1;
     // notice : do not ref columns
     _column_cache_handlers.clear();
 }
@@ -1231,9 +1235,13 @@ void TabletSchema::merge_dropped_columns(const 
TabletSchema& src_schema) {
 
 TabletSchemaSPtr TabletSchema::copy_without_variant_extracted_columns() {
     TabletSchemaSPtr copy = std::make_shared<TabletSchema>();
-    TabletSchemaPB tablet_schema_pb;
-    this->to_schema_pb(&tablet_schema_pb);
-    copy->init_from_pb(tablet_schema_pb, true /*ignore extracted_columns*/);
+    copy->shawdow_copy_without_columns(*this);
+    for (auto& col : this->columns()) {
+        if (col->is_extracted_column()) {
+            continue;
+        }
+        copy->append_column(*col);
+    }
     return copy;
 }
 
diff --git a/regression-test/data/variant_p0/variant_with_mow.out 
b/regression-test/data/variant_p0/variant_with_mow.out
new file mode 100644
index 00000000000..095c7b20356
Binary files /dev/null and 
b/regression-test/data/variant_p0/variant_with_mow.out differ
diff --git a/regression-test/suites/variant_p0/variant_with_mow.groovy 
b/regression-test/suites/variant_p0/variant_with_mow.groovy
new file mode 100644
index 00000000000..459a4061979
--- /dev/null
+++ b/regression-test/suites/variant_p0/variant_with_mow.groovy
@@ -0,0 +1,69 @@
+// 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
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("variant_with_mow") {
+    sql "DROP TABLE IF EXISTS var_mow"
+    sql """
+        CREATE TABLE `var_mow` (
+        `PORTALID` int NOT NULL,
+        `OBJECTTYPEID` varchar(65533) NOT NULL,
+        `OBJECTIDHASH` tinyint NOT NULL,
+        `OBJECTID` bigint NOT NULL,
+        `DELETED` boolean NULL DEFAULT "FALSE",
+        `INGESTIONTIMESTAMP` bigint NOT NULL,
+        `PROCESSEDTIMESTAMP` bigint NOT NULL,
+        `VERSION` bigint NULL DEFAULT "0",
+        `OVERFLOWPROPERTIES` variant NULL,
+        INDEX objects_properties_idx (`OVERFLOWPROPERTIES`) USING INVERTED 
COMMENT 'This is an inverted index on all properties of the object'
+        ) ENGINE=OLAP
+        UNIQUE KEY(`PORTALID`, `OBJECTTYPEID`, `OBJECTIDHASH`, `OBJECTID`)
+        DISTRIBUTED BY HASH(`PORTALID`, `OBJECTTYPEID`, `OBJECTIDHASH`) 
BUCKETS 1
+        PROPERTIES (
+        "replication_allocation" = "tag.location.default: 1",
+        "enable_unique_key_merge_on_write" = "true",
+        "function_column.sequence_col" = "VERSION",
+        "variant_max_subcolumns_count" = "100",
+        "disable_auto_compaction" = "true"
+        );
+    """
+
+    sql """ insert into var_mow values(944935233, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 30, "b": 40, "c": 50, "d": 
60, "e": 70, "f": 80, "g": 90, "h": 100, "i": 110, "j": 120}'); """
+    sql """ insert into var_mow values(944935234, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 31, "b": 41, "c": 51, "d": 
61, "e": 71, "f": 81, "g": 91, "h": 101, "i": 111, "j": 121}'); """
+    sql """ insert into var_mow values(944935235, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 32, "b": 42, "c": 52, "d": 
62, "e": 72, "f": 82, "g": 92, "h": 102, "i": 112, "j": 122}'); """
+    sql """ insert into var_mow values(944935236, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 33, "b": 43, "c": 53, "d": 
63, "e": 73, "f": 83, "g": 93, "h": 103, "i": 113, "j": 123}'); """
+    sql """ insert into var_mow values(944935237, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 34, "b": 44, "c": 54, "d": 
64, "e": 74, "f": 84, "g": 94, "h": 104, "i": 114, "j": 124}'); """
+    sql """ insert into var_mow values(944935238, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 35, "b": 45, "c": 55, "d": 
65, "e": 75, "f": 85, "g": 95, "h": 105, "i": 115, "j": 125}'); """
+    sql """ insert into var_mow values(944935239, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 36, "b": 46, "c": 56, "d": 
66, "e": 76, "f": 86, "g": 96, "h": 106, "i": 116, "j": 126}'); """
+    sql """ insert into var_mow values(944935240, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 37, "b": 47, "c": 57, "d": 
67, "e": 77, "f": 87, "g": 97, "h": 107, "i": 117, "j": 127}'); """
+    sql """ insert into var_mow values(944935241, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 38, "b": 48, "c": 58, "d": 
68, "e": 78, "f": 88, "g": 98, "h": 108, "i": 118, "j": 128}'); """
+    sql """ insert into var_mow values(944935242, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 39, "b": 49, "c": 59, "d": 
69, "e": 79, "f": 89, "g": 99, "h": 109, "i": 119, "j": 129}'); """
+    sql """ insert into var_mow values(944935243, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 40, "b": 50, "c": 60, "d": 
70, "e": 80, "f": 90, "g": 100, "h": 110, "i": 120, "j": 130}'); """
+    sql """ insert into var_mow values(944935244, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 41, "b": 51, "c": 61, "d": 
71, "e": 81, "f": 91, "g": 101, "h": 111, "i": 121, "j": 131}'); """
+    sql """ insert into var_mow values(944935245, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 42, "b": 52, "c": 62, "d": 
72, "e": 82, "f": 92, "g": 102, "h": 112, "i": 122, "j": 132}'); """
+    sql """ insert into var_mow values(944935246, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 43, "b": 53, "c": 63, "d": 
73, "e": 83, "f": 93, "g": 103, "h": 113, "i": 123, "j": 133}'); """
+    sql """ insert into var_mow values(944935247, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 44, "b": 54, "c": 64, "d": 
74, "e": 84, "f": 94, "g": 104, "h": 114, "i": 124, "j": 134}'); """
+    sql """ insert into var_mow values(944935248, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 45, "b": 55, "c": 65, "d": 
75, "e": 85, "f": 95, "g": 105, "h": 115, "i": 125, "j": 135}'); """
+    sql """ insert into var_mow values(944935249, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 46, "b": 56, "c": 66, "d": 
76, "e": 86, "f": 96, "g": 106, "h": 116, "i": 126, "j": 136}'); """
+    sql """ insert into var_mow values(944935250, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 47, "b": 57, "c": 67, "d": 
77, "e": 87, "f": 97, "g": 107, "h": 117, "i": 127, "j": 137}'); """
+    sql """ insert into var_mow values(944935251, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 48, "b": 58, "c": 68, "d": 
78, "e": 88, "f": 98, "g": 108, "h": 118, "i": 128, "j": 138}'); """
+    sql """ insert into var_mow values(944935252, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 49, "b": 59, "c": 69, "d": 
79, "e": 89, "f": 99, "g": 109, "h": 119, "i": 129, "j": 139}'); """
+    sql """ insert into var_mow values(944935253, '2', 1, 1, 'TRUE', 
1741682404960657985, 1741682404960657985, 0, '{"a": 50, "b": 60, "c": 70, "d": 
80, "e": 90, "f": 100, "g": 110, "h": 120, "i": 130, "j": 140}'); """
+
+    trigger_and_wait_compaction("var_mow", "cumulative")
+
+    qt_sql """ select objectId from var_mow objects_alias where 
objects_alias.portalid = 944935233 and objects_alias.objectTypeId = '2' limit 
100 """
+}
\ 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