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

commit 0eaa7840590b3677e4ffeff55c955c544a29a2ba
Author: Sun Chenyang <suncheny...@selectdb.com>
AuthorDate: Thu Feb 27 09:54:57 2025 +0800

    [fix](variant)fix new column reader (#48392)
---
 be/src/olap/rowset/segment_v2/segment.cpp          |   4 ++
 regression-test/data/variant_p0/rqg/fix_rqg1.out   | Bin 0 -> 109 bytes
 .../suites/variant_p0/rqg/fix_rqg1.groovy          |  50 +++++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/be/src/olap/rowset/segment_v2/segment.cpp 
b/be/src/olap/rowset/segment_v2/segment.cpp
index b90e92bcc73..dadf997081c 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -599,6 +599,10 @@ Status Segment::_create_column_readers(const 
SegmentFooterPB& footer) {
     std::unordered_map<int32_t, uint32_t> column_id_to_footer_ordinal;
     uint32_t ordinal = 0;
     for (const auto& column_meta : _footer_pb->columns()) {
+        // no need to create column reader for variant's subcolumn
+        if (column_meta.unique_id() == -1) {
+            continue;
+        }
         column_id_to_footer_ordinal.try_emplace(column_meta.unique_id(), 
ordinal++);
     }
     // init by unique_id
diff --git a/regression-test/data/variant_p0/rqg/fix_rqg1.out 
b/regression-test/data/variant_p0/rqg/fix_rqg1.out
new file mode 100644
index 00000000000..095c7b20356
Binary files /dev/null and b/regression-test/data/variant_p0/rqg/fix_rqg1.out 
differ
diff --git a/regression-test/suites/variant_p0/rqg/fix_rqg1.groovy 
b/regression-test/suites/variant_p0/rqg/fix_rqg1.groovy
new file mode 100644
index 00000000000..62f0c22d44a
--- /dev/null
+++ b/regression-test/suites/variant_p0/rqg/fix_rqg1.groovy
@@ -0,0 +1,50 @@
+// 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_rqg_fix1", "p0") {
+
+    sql """ drop table if exists 
table_200_undef_partitions2_keys3_properties4_distributed_by5 """
+    sql """
+        CREATE TABLE 
`table_200_undef_partitions2_keys3_properties4_distributed_by5` (
+        `pk` int NULL,
+        `var` variant NULL
+        ) ENGINE=OLAP
+        DUPLICATE KEY(`pk`)
+        DISTRIBUTED BY HASH(`pk`) BUCKETS 10
+        PROPERTIES (
+        "replication_allocation" = "tag.location.default: 1",
+        "min_load_replica_num" = "-1",
+        "is_being_synced" = "false",
+        "storage_medium" = "hdd",
+        "storage_format" = "V2",
+        "inverted_index_storage_format" = "V2",
+        "light_schema_change" = "true",
+        "variant_max_subcolumns_count" = "0",
+        "disable_auto_compaction" = "false",
+        "enable_single_replica_compaction" = "false",
+        "group_commit_interval_ms" = "10000",
+        "group_commit_data_bytes" = "134217728"
+        );
+        """
+
+     sql """ insert into 
table_200_undef_partitions2_keys3_properties4_distributed_by5 values(20, '{"k1" 
: 1, "k2" : "str", "k3" : 3, "k4" : "str2"}') """
+
+     qt_sql """ select count() from 
table_200_undef_partitions2_keys3_properties4_distributed_by5 where 
cast(var['k2'] as string) > 'bea' """
+}
+    
+


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

Reply via email to