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 0d9471287d..b73b6e8bda 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 hashJoinConjuncts = join.getEqualToConjuncts(); + List 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 0000000000..905ac6dd87 --- /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