diff --git a/regression-test/data/nereids_rules_p0/filter_push_down/push_filter_through.out b/regression-test/data/nereids_rules_p0/filter_push_down/push_filter_through.out index f32919b741..4487907374 100644 --- a/regression-test/data/nereids_rules_p0/filter_push_down/push_filter_through.out +++ b/regression-test/data/nereids_rules_p0/filter_push_down/push_filter_through.out @@ -1,9 +1,8 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !filter_project_alias -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((t1.id = 1)) -------PhysicalOlapScan[t1] +--filter((t1.id = 1)) +----PhysicalOlapScan[t1] -- !filter_project_constant -- PhysicalResultSink @@ -11,58 +10,48 @@ PhysicalResultSink -- !filter_project_arithmetic -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((cast(id as BIGINT) = 1)) -------PhysicalOlapScan[t1] +--filter((cast(id as BIGINT) = 1)) +----PhysicalOlapScan[t1] -- !filter_order_by -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((t.id = 1)) -------PhysicalOlapScan[t1] +--filter((t.id = 1)) +----PhysicalOlapScan[t1] -- !filter_order_by_limit -- PhysicalResultSink --filter((t.id = 1)) ----PhysicalTopN[MERGE_SORT] -------PhysicalDistribute[DistributionSpecGather] ---------PhysicalTopN[LOCAL_SORT] -----------PhysicalOlapScan[t1] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalOlapScan[t1] -- !filter_order_by_constant -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((t.id = 1)) +--filter((t.id = 1)) +----PhysicalOlapScan[t1] + +-- !filter_join_inner -- +PhysicalResultSink +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) ------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_inner -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_inner -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] - --- !filter_join_inner -- -PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.msg = '')) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t2] +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.msg = '')) +------PhysicalOlapScan[t1] +----PhysicalOlapScan[t2] -- !filter_join_inner -- PhysicalResultSink @@ -70,54 +59,44 @@ PhysicalResultSink -- !filter_join_inner -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=(((t1.id = 1) OR (t2.id = 2))) -------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t2] +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=(((t1.id = 1) OR (t2.id = 2))) +----PhysicalOlapScan[t1] +----PhysicalOlapScan[t2] -- !filter_join_left -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] +--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] + +-- !filter_join_left -- +PhysicalResultSink +--PhysicalEmptyRelation + +-- !filter_join_left -- +PhysicalResultSink +--filter(((t1.id = 1) OR (t2.id = 2))) ----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] - --- !filter_join_left -- -PhysicalResultSink ---PhysicalEmptyRelation - --- !filter_join_left -- -PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter(((t1.id = 1) OR (t2.id = 2))) -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalOlapScan[t1] ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalOlapScan[t2] +------PhysicalOlapScan[t1] +------PhysicalOlapScan[t2] -- !filter_join_right -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_full -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_left -- PhysicalResultSink @@ -125,367 +104,274 @@ PhysicalResultSink -- !filter_join_left -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter(((t1.id = 1) OR (t2.id = 2))) -------hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalOlapScan[t1] ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalOlapScan[t2] +--filter(((t1.id = 1) OR (t2.id = 2))) +----hashJoin[FULL_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +------PhysicalOlapScan[t1] +------PhysicalOlapScan[t2] -- !filter_join_cross -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----NestedLoopJoin[CROSS_JOIN] -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecReplicated] ---------PhysicalOlapScan[t2] +--NestedLoopJoin[CROSS_JOIN] +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----PhysicalOlapScan[t2] -- !filter_join_left_anti -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[LEFT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_left_semi -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[LEFT_SEMI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[LEFT_SEMI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_right_anti -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[RIGHT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------PhysicalDistribute[DistributionSpecHash] ---------filter((t1.id = 1)) -----------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[RIGHT_ANTI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_right_semi -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[RIGHT_SEMI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[RIGHT_SEMI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_join_right_semi -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[RIGHT_SEMI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -------filter((t1.id = 1)) ---------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 1)) -----------PhysicalOlapScan[t2] +--hashJoin[RIGHT_SEMI_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +----filter((t1.id = 1)) +------PhysicalOlapScan[t1] +----filter((t2.id = 1)) +------PhysicalOlapScan[t2] -- !filter_multi_inner -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() -------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((t1.id = 1)) -----------PhysicalOlapScan[t1] ---------PhysicalDistribute[DistributionSpecHash] -----------filter((t2.id = 1)) -------------PhysicalOlapScan[t2] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t3.id = 1)) -----------PhysicalOlapScan[t3] +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() +----hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +------filter((t1.id = 1)) +--------PhysicalOlapScan[t1] +------filter((t2.id = 1)) +--------PhysicalOlapScan[t2] +----filter((t3.id = 1)) +------PhysicalOlapScan[t3] -- !filter_mixed_inner_left -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((((t1.id = 1) AND (t2.id = 2)) OR (t3.id = 2))) -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[t1] -----------PhysicalDistribute[DistributionSpecHash] -------------PhysicalOlapScan[t2] ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalOlapScan[t3] +--filter((((t1.id = 1) AND (t2.id = 2)) OR (t3.id = 2))) +----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() +------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +--------PhysicalOlapScan[t1] +--------PhysicalOlapScan[t2] +------PhysicalOlapScan[t3] -- !filter_multi_left -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((((t1.id = 1) AND (t2.id > 1)) OR (t3.id < 4))) -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() ---------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------PhysicalOlapScan[t1] -----------PhysicalDistribute[DistributionSpecHash] -------------PhysicalOlapScan[t2] ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalOlapScan[t3] +--filter((((t1.id = 1) AND (t2.id > 1)) OR (t3.id < 4))) +----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() +------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +--------PhysicalOlapScan[t1] +--------PhysicalOlapScan[t2] +------PhysicalOlapScan[t3] -- !filter_multi_outer -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() ---------filter((t1.id = 1)) -----------PhysicalOlapScan[t1] ---------PhysicalDistribute[DistributionSpecHash] -----------filter((t2.id = 1)) -------------PhysicalOlapScan[t2] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t3.id = 1)) -----------PhysicalOlapScan[t3] +--hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() +----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +------filter((t1.id = 1)) +--------PhysicalOlapScan[t1] +------filter((t2.id = 1)) +--------PhysicalOlapScan[t2] +----filter((t3.id = 1)) +------PhysicalOlapScan[t3] -- !filter_multi_cross -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] +--NestedLoopJoin[CROSS_JOIN] ----NestedLoopJoin[CROSS_JOIN] -------NestedLoopJoin[CROSS_JOIN] ---------filter((t1.id = 1)) -----------PhysicalOlapScan[t1] ---------PhysicalDistribute[DistributionSpecReplicated] -----------PhysicalOlapScan[t2] -------PhysicalDistribute[DistributionSpecReplicated] ---------PhysicalOlapScan[t3] +------filter((t1.id = 1)) +--------PhysicalOlapScan[t1] +------PhysicalOlapScan[t2] +----PhysicalOlapScan[t3] -- !filter_multi_mixed -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t1.id = t4.id)) otherCondition=() -------hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() ---------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() -----------filter((t1.id = 1)) -------------PhysicalOlapScan[t1] -----------PhysicalDistribute[DistributionSpecHash] -------------filter((t2.id = 1)) ---------------PhysicalOlapScan[t2] ---------PhysicalDistribute[DistributionSpecHash] -----------filter((t3.id = 1)) -------------PhysicalOlapScan[t3] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t4.id = 1)) -----------PhysicalOlapScan[t4] +--hashJoin[INNER_JOIN] hashCondition=((t1.id = t4.id)) otherCondition=() +----hashJoin[LEFT_OUTER_JOIN] hashCondition=((t1.id = t3.id)) otherCondition=() +------hashJoin[INNER_JOIN] hashCondition=((t1.id = t2.id)) otherCondition=() +--------filter((t1.id = 1)) +----------PhysicalOlapScan[t1] +--------filter((t2.id = 1)) +----------PhysicalOlapScan[t2] +------filter((t3.id = 1)) +--------PhysicalOlapScan[t3] +----filter((t4.id = 1)) +------PhysicalOlapScan[t4] -- !filter_aggregation_filtered_agg_func -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((count(*) > 10)) -------hashAgg[GLOBAL] ---------PhysicalDistribute[DistributionSpecHash] -----------hashAgg[LOCAL] +--filter((count(*) > 10)) +----hashAgg[GLOBAL] +------hashAgg[LOCAL] +--------PhysicalOlapScan[t1] + +-- !filter_aggregation_group_set -- +PhysicalResultSink +--filter((cast(msg as DOUBLE) = 1.0)) +----hashAgg[GLOBAL] +------hashAgg[LOCAL] +--------PhysicalRepeat +----------filter((t1.id > 10)) ------------PhysicalOlapScan[t1] -- !filter_aggregation_group_set -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((cast(msg as DOUBLE) = 1.0)) -------hashAgg[GLOBAL] ---------PhysicalDistribute[DistributionSpecHash] -----------hashAgg[LOCAL] -------------PhysicalRepeat ---------------filter((t1.id > 10)) -----------------PhysicalOlapScan[t1] - --- !filter_aggregation_group_set -- -PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter(((t1.id > 10) OR (cast(msg as DOUBLE) = 1.0))) -------hashAgg[GLOBAL] ---------PhysicalDistribute[DistributionSpecHash] -----------hashAgg[LOCAL] -------------PhysicalRepeat ---------------PhysicalOlapScan[t1] +--filter(((t1.id > 10) OR (cast(msg as DOUBLE) = 1.0))) +----hashAgg[GLOBAL] +------hashAgg[LOCAL] +--------PhysicalRepeat +----------PhysicalOlapScan[t1] -- !filter_aggregation_filtered_key -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] +--hashAgg[GLOBAL] ----hashAgg[LOCAL] -------filter((t1.id > 10)) +------filter((t1.msg = '1')) --------PhysicalOlapScan[t1] -- !filter_aggregation_filtered_part_key -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashAgg[LOCAL] -------filter((t1.id > 10)) ---------PhysicalOlapScan[t1] - --- !filter_aggregation_filtered_part_key -- - --- !filter_aggregation_filtered_part_key -- -PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----filter((t.c > 10)) +--filter((t.c > 10)) +----hashAgg[GLOBAL] ------hashAgg[LOCAL] --------PhysicalOlapScan[t1] -- !push_filter_union -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashAgg[GLOBAL] -------PhysicalDistribute[DistributionSpecHash] ---------hashAgg[LOCAL] -----------PhysicalUnion -------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t1.id = 2)) -----------------PhysicalOlapScan[t1] -------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t2.id = 2)) -----------------PhysicalOlapScan[t2] +--hashAgg[GLOBAL] +----hashAgg[LOCAL] +------PhysicalUnion +--------filter((t1.id = 2)) +----------PhysicalOlapScan[t1] +--------filter((t2.id = 2)) +----------PhysicalOlapScan[t2] -- !push_filter_union_all -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalUnion -------PhysicalDistribute[DistributionSpecExecutionAny] ---------filter((t1.id = 2)) -----------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecExecutionAny] ---------filter((t2.id = 2)) -----------PhysicalOlapScan[t2] +--PhysicalUnion +----filter((t1.id = 2)) +------PhysicalOlapScan[t1] +----filter((t2.id = 2)) +------PhysicalOlapScan[t2] -- !push_filter_intersect -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalIntersect -------PhysicalDistribute[DistributionSpecHash] ---------filter((t1.id = 2)) -----------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 2)) -----------PhysicalOlapScan[t2] +--PhysicalIntersect +----filter((t1.id = 2)) +------PhysicalOlapScan[t1] +----filter((t2.id = 2)) +------PhysicalOlapScan[t2] -- !push_filter_except -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalExcept -------PhysicalDistribute[DistributionSpecHash] ---------filter((t1.id = 2)) -----------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 2)) -----------PhysicalOlapScan[t2] +--PhysicalExcept +----filter((t1.id = 2)) +------PhysicalOlapScan[t1] +----filter((t2.id = 2)) +------PhysicalOlapScan[t2] -- !push_filter_union -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashAgg[GLOBAL] -------PhysicalDistribute[DistributionSpecHash] ---------hashAgg[LOCAL] -----------PhysicalUnion -------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((cast(random() as INT) = 2)) -----------------PhysicalOneRowRelation -------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t2.id = 2)) -----------------PhysicalOlapScan[t2] +--hashAgg[GLOBAL] +----hashAgg[LOCAL] +------PhysicalUnion +--------filter((cast(random() as INT) = 2)) +----------PhysicalOneRowRelation +--------filter((t2.id = 2)) +----------PhysicalOlapScan[t2] -- !push_filter_union_all -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalUnion -------PhysicalDistribute[DistributionSpecExecutionAny] ---------filter(cast(random() as INT) IN (2, 3)) -----------PhysicalOneRowRelation -------PhysicalDistribute[DistributionSpecExecutionAny] ---------filter(id IN (2, 3)) -----------PhysicalOlapScan[t2] +--PhysicalUnion +----filter(cast(random() as INT) IN (2, 3)) +------PhysicalOneRowRelation +----filter(id IN (2, 3)) +------PhysicalOlapScan[t2] -- !push_filter_intersect -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalIntersect -------PhysicalDistribute[DistributionSpecHash] ---------filter(cast(random() as INT) IN (2, 3)) -----------PhysicalOneRowRelation -------PhysicalDistribute[DistributionSpecHash] ---------filter(id IN (2, 3)) -----------PhysicalOlapScan[t2] +--PhysicalIntersect +----filter(cast(random() as INT) IN (2, 3)) +------PhysicalOneRowRelation +----filter(id IN (2, 3)) +------PhysicalOlapScan[t2] -- !push_filter_except -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] +--PhysicalExcept +----filter((cast(random() as INT) = 2) and (t1.msg = '')) +------PhysicalOlapScan[t1] +----filter((t2.id = 2) and (t2.msg = '')) +------PhysicalOlapScan[t2] + +-- !push_filter_except -- +PhysicalResultSink +--hashJoin[INNER_JOIN] hashCondition=((t3.id = t.id)) otherCondition=() ----PhysicalExcept -------PhysicalDistribute[DistributionSpecHash] ---------filter((cast(random() as INT) = 2) and (t1.msg = '')) -----------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id = 2) and (t2.msg = '')) -----------PhysicalOlapScan[t2] - --- !push_filter_except -- -PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t3.id = t.id)) otherCondition=() -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalExcept -----------PhysicalDistribute[DistributionSpecHash] -------------filter((t1.id = 2)) ---------------PhysicalOlapScan[t1] -----------PhysicalDistribute[DistributionSpecHash] -------------filter((t2.id = 2)) ---------------PhysicalOlapScan[t2] -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t3] +------filter((t1.id = 2)) +--------PhysicalOlapScan[t1] +------filter((t2.id = 2)) +--------PhysicalOlapScan[t2] +----PhysicalOlapScan[t3] -- !push_filter_subquery -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----hashJoin[INNER_JOIN] hashCondition=((t3.id = t.id)) otherCondition=() -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalExcept -----------PhysicalDistribute[DistributionSpecHash] -------------filter((t1.id = 2)) ---------------PhysicalOlapScan[t1] -----------PhysicalDistribute[DistributionSpecHash] -------------filter((t2.id = 2)) ---------------PhysicalOlapScan[t2] -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t3] +--hashJoin[INNER_JOIN] hashCondition=((t3.id = t.id)) otherCondition=() +----PhysicalExcept +------filter((t1.id = 2)) +--------PhysicalOlapScan[t1] +------filter((t2.id = 2)) +--------PhysicalOlapScan[t2] +----PhysicalOlapScan[t3] -- !filter_window_row_number -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalWindow -------PhysicalQuickSort[LOCAL_SORT] ---------filter((t1.id <= 5)) -----------PhysicalOlapScan[t1] +--PhysicalWindow +----PhysicalQuickSort[LOCAL_SORT] +------filter((t1.id <= 5)) +--------PhysicalOlapScan[t1] -- !filter_window_order_row_number -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalWindow -------PhysicalQuickSort[LOCAL_SORT] ---------filter((t1.id <= 5)) -----------PhysicalOlapScan[t1] +--PhysicalWindow +----PhysicalQuickSort[LOCAL_SORT] +------filter((t1.id <= 5)) +--------PhysicalOlapScan[t1] -- !filter_window_row_number_complex_predicate -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalWindow -------PhysicalQuickSort[LOCAL_SORT] ---------PhysicalDistribute[DistributionSpecHash] -----------filter(((cast(id as DOUBLE) + cast(msg as DOUBLE)) = cast('' as DOUBLE))) -------------PhysicalOlapScan[t1] +--PhysicalWindow +----PhysicalQuickSort[LOCAL_SORT] +------filter(((cast(id as DOUBLE) + cast(msg as DOUBLE)) = cast('' as DOUBLE))) +--------PhysicalOlapScan[t1] -- !filter_multi_window -- PhysicalResultSink ---PhysicalDistribute[DistributionSpecGather] -----PhysicalWindow -------PhysicalQuickSort[LOCAL_SORT] ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalWindow -------------PhysicalQuickSort[LOCAL_SORT] ---------------PhysicalDistribute[DistributionSpecHash] -----------------filter(((t1.msg = '') OR (t1.id = 2))) -------------------PhysicalOlapScan[t1] +--PhysicalWindow +----PhysicalQuickSort[LOCAL_SORT] +------PhysicalWindow +--------PhysicalQuickSort[LOCAL_SORT] +----------filter(((t1.msg = '') OR (t1.id = 2))) +------------PhysicalOlapScan[t1] diff --git a/regression-test/suites/nereids_rules_p0/filter_push_down/push_filter_through.groovy b/regression-test/suites/nereids_rules_p0/filter_push_down/push_filter_through.groovy index 0c9229249b..16c06b8edd 100644 --- a/regression-test/suites/nereids_rules_p0/filter_push_down/push_filter_through.groovy +++ b/regression-test/suites/nereids_rules_p0/filter_push_down/push_filter_through.groovy @@ -22,7 +22,7 @@ suite("push_filter_through") { sql "use regression_test_nereids_rules_p0" sql "set disable_join_reorder=true" sql 'set be_number_for_test=3' - sql "SET ignore_shape_nodes='PhysicalDistribute[DistributionSpecGather], PhysicalDistribute[DistributionSpecHash],PhysicalProject'" + sql "SET ignore_shape_nodes='PhysicalDistribute, PhysicalProject'" sql "set enable_fold_nondeterministic_fn=false" // push filter through alias @@ -204,19 +204,12 @@ suite("push_filter_through") { """ // Push filter of group by key through aggregated filter qt_filter_aggregation_filtered_key""" - explain shape plan select count() from t1 group by id having id > 10; - """ - // Push filter of part of group by key through aggregated filter - qt_filter_aggregation_filtered_part_key""" - explain shape plan select count() from t1 group by id, msg having id > 10; - """ - // Push filter to subquery with constant - qt_filter_aggregation_filtered_part_key""" - select * from (select count(), rand() as c from t1 group by id) t where c > 10; + explain shape plan select count() from t1 group by msg having msg = "1"; """ + // Push filter to subquery with alias qt_filter_aggregation_filtered_part_key""" - explain shape plan select * from (select id + 1, count() as c from t1 group by id) t where c > 10; + explain shape plan select * from (select msg, count() as c from t1 group by msg) t where c > 10; """ // Push filter through UNION qt_push_filter_union"""