This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 50e2d522010 branch-4.0: [bug](column) fix unnest_nullable could not
handle const column size #56472 (#56607)
50e2d522010 is described below
commit 50e2d522010e11d0767cd1b412a27003c5717ec3
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Sep 29 11:17:35 2025 +0800
branch-4.0: [bug](column) fix unnest_nullable could not handle const column
size #56472 (#56607)
Cherry-picked from #56472
Co-authored-by: zhangstar333 <[email protected]>
---
be/src/vec/core/column_with_type_and_name.cpp | 4 +-
.../vec/core/column_with_type_and_name_test.cpp | 1 +
.../bitmap_functions/test_bitmap_and.out | 11 +++
.../bitmap_functions/test_bitmap_and.groovy | 102 +++++++++++++++++++++
4 files changed, 116 insertions(+), 2 deletions(-)
diff --git a/be/src/vec/core/column_with_type_and_name.cpp
b/be/src/vec/core/column_with_type_and_name.cpp
index d73d15ee20a..beba95246b4 100644
--- a/be/src/vec/core/column_with_type_and_name.cpp
+++ b/be/src/vec/core/column_with_type_and_name.cpp
@@ -106,8 +106,8 @@ ColumnWithTypeAndName
ColumnWithTypeAndName::unnest_nullable(
assert_cast<const ColumnNullable*,
TypeCheckOnRelease::DISABLE>(
column_ptr.get());
if (is_const) {
- nested_column =
ColumnConst::create(source_column->get_nested_column_ptr(),
- source_column->size());
+ nested_column =
+
ColumnConst::create(source_column->get_nested_column_ptr(), column->size());
} else {
nested_column = source_column->get_nested_column_ptr();
}
diff --git a/be/test/vec/core/column_with_type_and_name_test.cpp
b/be/test/vec/core/column_with_type_and_name_test.cpp
index 50671c9129d..6f2329320b2 100644
--- a/be/test/vec/core/column_with_type_and_name_test.cpp
+++ b/be/test/vec/core/column_with_type_and_name_test.cpp
@@ -37,6 +37,7 @@ TEST(ColumnWithTypeAndNameTest, get_nested_test) {
column_with_type_and_name.name = "column_with_type_and_name";
auto result = column_with_type_and_name.unnest_nullable(true);
EXPECT_TRUE(is_column_const(*result.column));
+ EXPECT_EQ(result.column->size(), 3);
}
} // namespace doris::vectorized
diff --git
a/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_and.out
b/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_and.out
new file mode 100644
index 00000000000..f0864825498
--- /dev/null
+++
b/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_and.out
@@ -0,0 +1,11 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !sql_bitmap_and_1 --
+3
+4
+4
+
+-- !sql_bitmap_and_2 --
+\N
+\N
+\N
+
diff --git
a/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_and.groovy
b/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_and.groovy
new file mode 100644
index 00000000000..cf8bcd6db02
--- /dev/null
+++
b/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_and.groovy
@@ -0,0 +1,102 @@
+// 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("test_bitmap_and") {
+ sql """ DROP TABLE IF EXISTS unique_user_tags_mor; """
+ sql """
+ CREATE TABLE unique_user_tags_mor (
+ user_id BIGINT,
+ visit_date DATE,
+ tags_bitmap BITMAP COMMENT '用户标签Bitmap'
+ )
+ UNIQUE KEY(user_id, visit_date)
+ DISTRIBUTED BY HASH(user_id) BUCKETS 10
+ PROPERTIES (
+ "replication_num" = "1",
+ "enable_unique_key_merge_on_write" = "false"
+ );
+ """
+
+ sql """
+ INSERT INTO unique_user_tags_mor VALUES
+ (1001, '2023-10-01', to_bitmap(101)),
+ (1002, '2023-10-01', to_bitmap(102)),
+ (1003, '2023-10-01', to_bitmap(103));
+ """
+
+ sql """
+ INSERT INTO unique_user_tags_mor VALUES
+ (1001, '2023-10-01', bitmap_or(to_bitmap(101), to_bitmap(102)));
+ """
+ sql """
+ INSERT INTO unique_user_tags_mor VALUES
+ (1001, '2023-10-01', bitmap_from_string('101,102,103')),
+ (1002, '2023-10-01', bitmap_from_string('102,104')),
+ (1003, '2023-10-01', bitmap_from_string('101,103,105')),
+ (1004, '2023-10-01', bitmap_from_string('104,106')),
+ (1005, '2023-10-01', bitmap_from_string('101,102,103,104')),
+ (1006, '2023-10-01', bitmap_from_string('105,106')),
+ (1007, '2023-10-01', bitmap_from_string('101,107')),
+ (1008, '2023-10-01', bitmap_from_string('102,103,108')),
+ (1009, '2023-10-01', bitmap_from_string('104,105,109')),
+ (1010, '2023-10-01', bitmap_from_string('101,110'));
+ """
+ sql """
+ INSERT INTO unique_user_tags_mor VALUES
+ (1001, '2023-10-02', bitmap_from_string('101,102,104')),
+ (1002, '2023-10-02', bitmap_from_string('102,103,105')),
+ (1003, '2023-10-02', bitmap_from_string('101,106')),
+ (1004, '2023-10-02', bitmap_from_string('104,107')),
+ (1005, '2023-10-02', bitmap_from_string('102,103,108')),
+ (1006, '2023-10-02', bitmap_from_string('105,106,109')),
+ (1007, '2023-10-02', bitmap_from_string('101,110')),
+ (1008, '2023-10-02', bitmap_from_string('103,104')),
+ (1009, '2023-10-02', bitmap_from_string('105,107')),
+ (1010, '2023-10-02', bitmap_from_string('101,102,108'));
+ """
+ sql """
+ INSERT INTO unique_user_tags_mor VALUES
+ (1001, '2023-10-03', bitmap_from_string('101,103,105')),
+ (1002, '2023-10-03', bitmap_from_string('102,104,106')),
+ (1003, '2023-10-03', bitmap_from_string('107,108')),
+ (1004, '2023-10-03', bitmap_from_string('104,105,109')),
+ (1005, '2023-10-03', bitmap_from_string('101,110')),
+ (1006, '2023-10-03', bitmap_from_string('102,103')),
+ (1007, '2023-10-03', bitmap_from_string('104,105')),
+ (1008, '2023-10-03', bitmap_from_string('106,107')),
+ (1009, '2023-10-03', bitmap_from_string('108,109')),
+ (1010, '2023-10-03', bitmap_from_string('101,110'));
+
+ """
+
+ qt_sql_bitmap_and_1 """ SELECT bitmap_count(
+ bitmap_andnot(
+ bitmap_or(
+ tags_bitmap,
+ bitmap_from_string('100,200,300')
+ ),
+ bitmap_and(
+ tags_bitmap,
+ bitmap_from_string('101,102,103')
+ )
+ )
+ )
+ FROM unique_user_tags_mor
+ WHERE user_id = 1001 order by user_id;
+ """
+ qt_sql_bitmap_and_2 """ select bitmap_and(
tags_bitmap, bitmap_from_string('101,102,103') )
FROM unique_user_tags_mor WHERE user_id = 1001 order by user_id; """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]