You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/30 11:44:20 UTC
[doris] 09/15: [fix](planner) SetOperationNode's slots' nullability calculation is wrong (#19108)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 5ec2437c2f58f5f74d88e138e752b4343e38b317
Author: starocean999 <40...@users.noreply.github.com>
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 11760f79b4..02c5c49c1f 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
@@ -215,7 +215,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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org