This is an automated email from the ASF dual-hosted git repository.
huajianlan 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 070489cc828 [fix](Nerieds) fix Illegal join with wrong distribution
STORAGE_BUCKETED (#44257)
070489cc828 is described below
commit 070489cc82864e1d2eaaaefb96c3b7962dc289e0
Author: 924060929 <[email protected]>
AuthorDate: Wed Nov 20 15:10:57 2024 +0800
[fix](Nerieds) fix Illegal join with wrong distribution STORAGE_BUCKETED
(#44257)
fix
```
java.lang.IllegalStateException: exceptions : exception : errCode = 2,
detailMessage = Illegal join with wrong distribution, left: STORAGE_BUCKETED,
right: STORAGE_BUCKETED
```
---
.../properties/ChildOutputPropertyDeriver.java | 24 +------
.../distribute/shuffle_storage_bucketed.groovy | 78 ++++++++++++++++++++++
2 files changed, 80 insertions(+), 22 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java
index 1a95fb5f9e3..11d35f93346 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java
@@ -549,30 +549,10 @@ public class ChildOutputPropertyDeriver extends
PlanVisitor<PhysicalProperties,
ShuffleType rightShuffleType = rightHashSpec.getShuffleType();
switch (leftShuffleType) {
case EXECUTION_BUCKETED:
- if (rightShuffleType == ShuffleType.EXECUTION_BUCKETED) {
- return ShuffleSide.BOTH;
- }
- break;
case STORAGE_BUCKETED:
- if (rightShuffleType == ShuffleType.NATURAL) {
- // use storage hash to shuffle left to right to do bucket
shuffle join
- return ShuffleSide.LEFT;
- }
- break;
+ return rightShuffleType == ShuffleType.NATURAL ?
ShuffleSide.LEFT : ShuffleSide.BOTH;
case NATURAL:
- switch (rightShuffleType) {
- case NATURAL:
- // colocate join
- return ShuffleSide.NONE;
- case STORAGE_BUCKETED:
- // use storage hash to shuffle right to left to do
bucket shuffle join
- return ShuffleSide.RIGHT;
- case EXECUTION_BUCKETED:
- // compatible old ut
- return ShuffleSide.RIGHT;
- default:
- }
- break;
+ return rightShuffleType == ShuffleType.NATURAL ?
ShuffleSide.NONE : ShuffleSide.RIGHT;
default:
}
throw new IllegalStateException(
diff --git
a/regression-test/suites/nereids_syntax_p0/distribute/shuffle_storage_bucketed.groovy
b/regression-test/suites/nereids_syntax_p0/distribute/shuffle_storage_bucketed.groovy
new file mode 100644
index 00000000000..884336d0b73
--- /dev/null
+++
b/regression-test/suites/nereids_syntax_p0/distribute/shuffle_storage_bucketed.groovy
@@ -0,0 +1,78 @@
+// 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("shuffle_storage_bucketed") {
+ multi_sql """
+ drop table if exists du;
+ drop table if exists o;
+ drop table if exists ds;
+
+ CREATE TABLE `du` (
+ `et` datetime NOT NULL,
+ `st` datetime NOT NULL,
+ `gc` varchar(50) NOT NULL,
+ `pc` varchar(50) NOT NULL,
+ `uk` varchar(255) NOT NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`et`, `st`, `gc`, `pc`, `uk`)
+ DISTRIBUTED BY HASH(`gc`, `pc`) BUCKETS 4
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+
+ CREATE TABLE `o` (
+ `d` date NULL,
+ `g` varchar(500) NULL,
+ `p` varchar(500) NULL,
+ `dt` datetime NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`d`, `g`, `p`)
+ DISTRIBUTED BY HASH(`g`, `p`) BUCKETS 4
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+
+ CREATE TABLE `ds` (
+ `gc` varchar(50) NOT NULL,
+ `pc` varchar(50) NOT NULL,
+ `s` int NULL,
+ `n` varchar(50) NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`gc`, `pc`, `s`, `n`)
+ DISTRIBUTED BY HASH(`gc`, `pc`, `s`, `n`) BUCKETS 4
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+
+ set disable_nereids_rules='PRUNE_EMPTY_PARTITION';
+ """
+
+ sql """
+ explain plan
+ select *
+ from du
+ right outer join
+ (
+ select g gc, p pc
+ from o
+ where date(dt) = '2020-05-25 00:00:00'
+ ) r
+ on r.gc=du.gc and r.pc=du.pc
+ left join ds s
+ on r.gc=s.gc and r.pc=s.pc;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]