This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 82fbfab77f [fix](union)the union node should not pass through children
in some case (#15286)
82fbfab77f is described below
commit 82fbfab77f9dbc327fa6a05abad24527ff21ac73
Author: starocean999 <[email protected]>
AuthorDate: Fri Dec 23 10:27:49 2022 +0800
[fix](union)the union node should not pass through children in some case
(#15286)
the union node will make children pass through in wrong condition. If the
children's materialized slots are different from union node, children can't be
passed through.
---
.../org/apache/doris/planner/SetOperationNode.java | 3 ++
.../correctness_p0/test_union_subquery_groupby.out | 4 ++
.../test_union_subquery_groupby.groovy | 57 ++++++++++++++++++++++
3 files changed, 64 insertions(+)
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 3e939e8513..cfa32316b7 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
@@ -289,6 +289,9 @@ public abstract class SetOperationNode extends PlanNode {
for (int i = 0; i < setOpResultExprs.size(); ++i) {
if (!setOpTupleDescriptor.getSlots().get(i).isMaterialized()) {
+ if (VectorizedUtil.isVectorized() &&
childTupleDescriptor.getSlots().get(i).isMaterialized()) {
+ return false;
+ }
continue;
}
SlotRef setOpSlotRef =
setOpResultExprs.get(i).unwrapSlotRef(false);
diff --git
a/regression-test/data/correctness_p0/test_union_subquery_groupby.out
b/regression-test/data/correctness_p0/test_union_subquery_groupby.out
new file mode 100644
index 0000000000..72d126351a
--- /dev/null
+++ b/regression-test/data/correctness_p0/test_union_subquery_groupby.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !select --
+1
+
diff --git
a/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
b/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
new file mode 100644
index 0000000000..fe400781d0
--- /dev/null
+++ b/regression-test/suites/correctness_p0/test_union_subquery_groupby.groovy
@@ -0,0 +1,57 @@
+// 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_union_subquery_groupby") {
+ sql """
+ drop table if exists t_union_subquery_group_by;
+ """
+
+ sql """
+ CREATE TABLE `t_union_subquery_group_by` (
+ `org_id` bigint(20) NULL,
+ `org_name` text NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`org_id`)
+ COMMENT "OLAP"
+ DISTRIBUTED BY HASH(`org_id`) BUCKETS 3
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "in_memory" = "false",
+ "storage_format" = "V2"
+ );
+ """
+
+ sql """
+ insert into t_union_subquery_group_by values(1,'1'),(2,'1');
+ """
+
+ qt_select """
+ SELECT `org_name`
+ FROM
+ ( SELECT org_id, org_name
+ FROM t_union_subquery_group_by
+ GROUP BY org_id, org_name
+ UNION ALL
+ SELECT org_id, org_name
+ FROM t_union_subquery_group_by
+ GROUP BY org_id, org_name) T GROUP BY `org_name`;
+ """
+
+ sql """
+ drop table if exists t_union_subquery_group_by;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]