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 2024/01/10 02:23:51 UTC
(doris) branch master updated: [fix](nereids) generate correct order for runtime filter when contains NullSafeEquals hash condition (#29726)
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 a670e05adf2 [fix](nereids) generate correct order for runtime filter when contains NullSafeEquals hash condition (#29726)
a670e05adf2 is described below
commit a670e05adf2b265f06b7929b4d66c79a8f2dcf9e
Author: minghong <en...@gmail.com>
AuthorDate: Wed Jan 10 10:23:44 2024 +0800
[fix](nereids) generate correct order for runtime filter when contains NullSafeEquals hash condition (#29726)
Be do not support RF for NullSafeEquals, so fe not generate RF for them.
However, after we support NullSafeEquals as Hash join condition,
the order of RF is wrong when generating RF in FE. this PR fix it.
---
.../processor/post/RuntimeFilterGenerator.java | 22 +++++-----
.../runtime_filter/runtime_filter.groovy | 48 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 10 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
index 83d7b00b573..da28b40b038 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java
@@ -368,18 +368,20 @@ public class RuntimeFilterGenerator extends PlanPostProcessor {
.filter(type -> (type.getValue() & ctx.getSessionVariable().getRuntimeFilterType()) > 0)
.collect(Collectors.toList());
- List<EqualTo> hashJoinConjuncts = join.getEqualToConjuncts();
+ List<Expression> hashJoinConjuncts = join.getHashJoinConjuncts().stream().collect(Collectors.toList());
for (int i = 0; i < hashJoinConjuncts.size(); i++) {
- EqualTo equalTo = ((EqualTo) JoinUtils.swapEqualToForChildrenOrder(
- hashJoinConjuncts.get(i), join.left().getOutputSet()));
- for (TRuntimeFilterType type : legalTypes) {
- //bitmap rf is generated by nested loop join.
- if (type == TRuntimeFilterType.BITMAP) {
- continue;
+ if (hashJoinConjuncts.get(i) instanceof EqualTo) {
+ EqualTo equalTo = ((EqualTo) JoinUtils.swapEqualToForChildrenOrder(
+ (EqualTo) hashJoinConjuncts.get(i), join.left().getOutputSet()));
+ for (TRuntimeFilterType type : legalTypes) {
+ //bitmap rf is generated by nested loop join.
+ if (type == TRuntimeFilterType.BITMAP) {
+ continue;
+ }
+ long buildSideNdv = getBuildSideNdv(join, equalTo);
+ join.pushDownRuntimeFilter(context, generator, join, equalTo.right(),
+ equalTo.left(), type, buildSideNdv, i);
}
- long buildSideNdv = getBuildSideNdv(join, equalTo);
- join.pushDownRuntimeFilter(context, generator, join, equalTo.right(),
- equalTo.left(), type, buildSideNdv, i);
}
}
}
diff --git a/regression-test/suites/nereids_p0/runtime_filter/runtime_filter.groovy b/regression-test/suites/nereids_p0/runtime_filter/runtime_filter.groovy
new file mode 100644
index 00000000000..905ac6dd87b
--- /dev/null
+++ b/regression-test/suites/nereids_p0/runtime_filter/runtime_filter.groovy
@@ -0,0 +1,48 @@
+// 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("runtime_filter") {
+ sql ''' drop table if exists rf_dws_asset_domain_statistics_daily'''
+ sql '''CREATE TABLE rf_dws_asset_domain_statistics_daily (
+ account_id int(11) NULL,
+ ssp_id int(11) NULL,
+ account_name varchar(500) NULL,
+ d_s date NOT NULL
+ ) ENGINE = OLAP
+ DUPLICATE KEY(account_id, ssp_id, account_name) COMMENT 'OLAP'
+ PARTITION BY RANGE(d_s) (PARTITION p20231220 VALUES [('2023-12-20'), ('2023-12-21')))
+ DISTRIBUTED BY HASH(account_name) BUCKETS 9
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ ); '''
+
+ sql "set runtime_filter_mode=GLOBAL"
+
+ explain {
+ sql """
+ SELECT count(*) FROM
+ rf_dws_asset_domain_statistics_daily t1
+ INNER JOIN (
+ SELECT account_id, account_name
+ FROM dws_asset_domain_statistics_daily
+ WHERE d_s = '2023-12-20'
+ ) t2
+ ON (t1.account_id <=> t2.account_id);
+ """
+ notContains("RFs")
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org