This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new aacc075f09 [fix](planner) SetOperationNode's slots' nullability
calculation is wrong (#19108)
aacc075f09 is described below
commit aacc075f09846ddd652a30f6c73fdb8180ebf5bd
Author: starocean999 <[email protected]>
AuthorDate: Wed Apr 26 21:18:37 2023 +0800
[fix](planner) SetOperationNode's slots' nullability calculation is wrong
(#19108)
SetOperationNode's slots' nullability should consider slots info from all
children, even some children have EmptyResultSet
---
.../org/apache/doris/planner/SetOperationNode.java | 3 +-
.../correctness_p0/test_union_subquery_groupby.out | 3 ++
.../test_union_subquery_groupby.groovy | 48 ++++++++++++++++++++++
3 files changed, 53 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/SetOperationNode.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/SetOperationNode.java
index ae8c710a3b..f4e1bb7fc1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/SetOperationNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SetOperationNode.java
@@ -219,7 +219,8 @@ public abstract class SetOperationNode extends PlanNode {
for (int j = 1; j < resultExprLists.size(); j++) {
isNullable = isNullable ||
resultExprLists.get(j).get(i).isNullable();
}
- tupleDescriptor.getSlots().get(i).setIsNullable(isNullable);
+ tupleDescriptor.getSlots().get(i).setIsNullable(
+ tupleDescriptor.getSlots().get(i).getIsNullable() ||
isNullable);
tupleDescriptor.computeMemLayout();
}
}
diff --git
a/regression-test/data/correctness_p0/test_union_subquery_groupby.out
b/regression-test/data/correctness_p0/test_union_subquery_groupby.out
index 72d126351a..8c1ce10bcc 100644
--- a/regression-test/data/correctness_p0/test_union_subquery_groupby.out
+++ b/regression-test/data/correctness_p0/test_union_subquery_groupby.out
@@ -2,3 +2,6 @@
-- !select --
1
+-- !select2 --
+9.0
+
diff --git
a/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
b/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
index fe400781d0..922c137eed 100644
--- a/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
+++ b/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
@@ -54,4 +54,52 @@ suite("test_union_subquery_groupby") {
sql """
drop table if exists t_union_subquery_group_by;
"""
+
+ sql """
+ drop table if exists union_table_test;
+ """
+
+ sql """
+ CREATE TABLE IF NOT EXISTS `union_table_test`
+ (
+ `dt` DATEV2 NOT NULL,
+ `label` VARCHAR(30) NOT NULL,
+ `uid_bitmap` BITMAP BITMAP_UNION NULL
+ )
+ AGGREGATE KEY (`dt`, `label`)
+ DISTRIBUTED BY HASH(`label`) BUCKETS AUTO
+ PROPERTIES
+ (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ sql """
+ INSERT INTO union_table_test (dt, label, uid_bitmap) VALUES
+ ('2023-04-01', 'new_user', bitmap_from_string("1,2,3,4,5,6,7,8,9"));
+ """
+
+ qt_select2 """
+ SELECT
+ AVG(`source`.`uid_count`) AS `avg`
+ FROM (with temp1 AS
+ (SELECT dt,
+ label,
+ bitmap_count(uid_bitmap) AS uid_count
+ FROM union_table_test
+
+ UNION
+ all SELECT t1.dt,
+ 'new/active' AS label, bitmap_count(t1.uid_bitmap) /
bitmap_count(t1.uid_bitmap) AS uid_count
+ FROM union_table_test t1)
+ SELECT *
+ FROM temp1
+ ) AS `source`
+ WHERE (`source`.`label` = 'new_user')
+ GROUP BY DATE(`source`.`dt`);
+ """
+
+ sql """
+ drop table if exists union_table_test;
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]