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 3cff9dfd001901..c7e8ae01fcd75f 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 @@ -275,10 +275,6 @@ public PhysicalPlan visitPhysicalHashJoin(PhysicalHashJoin pair = ctx.getAliasTransferMap().get(equalTo.right()); - if (pair == null) { - continue; - } if (equalTo.left().getInputSlots().size() == 1) { RuntimeFilterPushDownVisitor.PushDownContext pushDownContext = RuntimeFilterPushDownVisitor.PushDownContext.createPushDownContextForHashJoin( diff --git a/regression-test/data/nereids_p0/runtime_filter/check_rf.out b/regression-test/data/nereids_p0/runtime_filter/check_rf.out new file mode 100644 index 00000000000000..48ffb4af70ec2a --- /dev/null +++ b/regression-test/data/nereids_p0/runtime_filter/check_rf.out @@ -0,0 +1,16 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !1 -- +PhysicalResultSink +--PhysicalDistribute[DistributionSpecGather] +----PhysicalProject +------hashJoin[INNER_JOIN broadcast] hashCondition=((t1.id = t2.maxId)) otherCondition=() build RFs:RF0 maxId->[id] +--------PhysicalProject +----------PhysicalOlapScan[t1] apply RFs: RF0 +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter((t1.id < 100)) +--------------------PhysicalOlapScan[t1] + diff --git a/regression-test/suites/nereids_p0/runtime_filter/check_rf.groovy b/regression-test/suites/nereids_p0/runtime_filter/check_rf.groovy new file mode 100644 index 00000000000000..489d6ce15cf2cf --- /dev/null +++ b/regression-test/suites/nereids_p0/runtime_filter/check_rf.groovy @@ -0,0 +1,51 @@ +// 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("check_rf") { + sql """ + drop table if exists t1; + set disable_join_reorder=true; + set enable_parallel_result_sink=false; + set runtime_filter_type=2; + """ + sql """ + CREATE TABLE IF NOT EXISTS t1 ( + `app_name` VARCHAR(64) NULL COMMENT '标识', + `event_id` VARCHAR(128) NULL COMMENT '标识', + `decision` VARCHAR(32) NULL COMMENT '枚举值', + `time` DATETIME NULL COMMENT '查询时间', + `id` int NOT NULL COMMENT 'od' + ) + DISTRIBUTED BY HASH(event_id) + BUCKETS 3 PROPERTIES ("replication_num" = "1"); + """ + + sql """ + insert into t1 values + ('aa', 'bc', 'cc', '2024-07-03 01:15:30', 1), + ('ab', 'bc', 'cc', '2024-07-03 01:15:30', 2), + ('ac', 'bc', 'cc', '2024-07-03 01:15:30', 3), + ('ad', 'bc', 'cc', '2024-07-03 01:15:30', 4); + """ + + // even if equalTo.right is not in aliasTransferMap, generate the rf + qt_1 """ + explain shape plan + select t1.app_name + from t1 join (select max(id) as maxId from t1 where id < 100 group by app_name) t2 on t1.id = t2.maxId; + """ +} \ No newline at end of file