Skip to content

[feature](runtime filter) Add decoupled runtime filter support - #62737

Merged
englefly merged 5 commits into
apache:masterfrom
englefly:decouple-rf
Jun 1, 2026
Merged

englefly merged 5 commits into
apache:masterfrom
englefly:decouple-rf

Conversation

@englefly

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@englefly

englefly commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@englefly

englefly commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@englefly englefly changed the title Decouple rf [feature](runtime filter) Add decoupled runtime filter support May 6, 2026
@englefly

englefly commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@englefly

englefly commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 30496 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 71579e4f6cfeb787dfb03c56213d8469382c6881, data reload: false

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17629	3897	3835	3835
q2	q3	10724	888	615	615
q4	4710	472	341	341
q5	8856	1762	1594	1594
q6	294	182	140	140
q7	957	949	779	779
q8	11279	1499	1224	1224
q9	7646	6013	5956	5956
q10	6688	1786	1530	1530
q11	491	280	265	265
q12	661	420	298	298
q13	18163	3397	2787	2787
q14	296	288	263	263
q15	q16	898	871	792	792
q17	985	1096	737	737
q18	6564	5731	5821	5731
q19	1297	1375	1051	1051
q20	549	407	273	273
q21	4716	2334	1966	1966
q22	452	386	319	319
Total cold run time: 103855 ms
Total hot run time: 30496 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4841	4546	4608	4546
q2	q3	4647	4808	4209	4209
q4	2161	2172	1414	1414
q5	5058	5009	5262	5009
q6	210	178	153	153
q7	2046	1794	1619	1619
q8	3400	3105	3097	3097
q9	8415	8402	8339	8339
q10	4459	4504	4279	4279
q11	597	406	399	399
q12	701	743	529	529
q13	3439	3600	2941	2941
q14	310	304	279	279
q15	q16	768	779	696	696
q17	1326	1322	1261	1261
q18	8018	7170	7135	7135
q19	1172	1144	1149	1144
q20	2218	2260	1953	1953
q21	6152	5366	4843	4843
q22	514	480	402	402
Total cold run time: 60452 ms
Total hot run time: 54247 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 168769 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 71579e4f6cfeb787dfb03c56213d8469382c6881, data reload: false

query5	4345	660	513	513
query6	333	221	224	221
query7	4281	567	323	323
query8	340	242	246	242
query9	8836	4120	4069	4069
query10	446	369	311	311
query11	5387	2118	1894	1894
query12	185	138	138	138
query13	1284	624	472	472
query14	6126	5486	5150	5150
query14_1	4363	4345	4357	4345
query15	212	201	183	183
query16	1001	477	436	436
query17	1114	781	617	617
query18	2744	475	352	352
query19	230	207	180	180
query20	147	144	135	135
query21	219	137	121	121
query22	13745	13648	13410	13410
query23	17283	16338	16012	16012
query23_1	16115	16066	15991	15991
query24	7445	1735	1377	1377
query24_1	1363	1343	1397	1343
query25	621	486	449	449
query26	1347	319	170	170
query27	2667	595	349	349
query28	4408	2002	1981	1981
query29	1025	639	509	509
query30	301	242	201	201
query31	1115	1085	971	971
query32	93	75	76	75
query33	561	356	304	304
query34	1192	1181	646	646
query35	767	796	678	678
query36	1347	1308	1117	1117
query37	154	113	95	95
query38	3234	3157	3073	3073
query39	923	919	901	901
query39_1	873	882	897	882
query40	236	177	139	139
query41	67	64	62	62
query42	112	113	115	113
query43	326	330	280	280
query44	
query45	211	199	194	194
query46	1104	1183	760	760
query47	2282	2289	2149	2149
query48	416	417	284	284
query49	642	535	424	424
query50	744	284	225	225
query51	4346	4279	4189	4189
query52	107	117	97	97
query53	265	293	204	204
query54	332	318	272	272
query55	100	98	93	93
query56	348	330	343	330
query57	1419	1404	1313	1313
query58	311	295	282	282
query59	1604	1624	1383	1383
query60	371	355	342	342
query61	186	207	153	153
query62	666	614	569	569
query63	237	202	205	202
query64	2434	821	690	690
query65	
query66	1741	519	391	391
query67	30151	30034	30015	30015
query68	
query69	463	338	317	317
query70	1022	1059	1055	1055
query71	318	286	281	281
query72	2980	2800	2440	2440
query73	848	780	401	401
query74	4021	3826	3659	3659
query75	2819	2669	2351	2351
query76	2318	1187	773	773
query77	431	435	359	359
query78	12910	12871	12441	12441
query79	1281	996	726	726
query80	658	647	553	553
query81	457	285	249	249
query82	249	169	128	128
query83	288	292	271	271
query84	268	147	120	120
query85	881	588	527	527
query86	386	330	308	308
query87	3407	3363	3330	3330
query88	3579	2695	2690	2690
query89	425	386	340	340
query90	2142	189	194	189
query91	177	167	138	138
query92	81	78	76	76
query93	948	967	576	576
query94	515	328	308	308
query95	670	393	344	344
query96	1099	789	355	355
query97	2699	2681	2594	2594
query98	246	236	241	236
query99	1076	1100	984	984
Total cold run time: 250244 ms
Total hot run time: 168769 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 94.23% (49/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.53% (20632/38545)
Line Coverage 37.17% (194791/524122)
Region Coverage 33.52% (151954/453389)
Branch Coverage 34.55% (66273/191805)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 96.15% (50/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.76% (27843/37749)
Line Coverage 57.63% (301280/522749)
Region Coverage 54.86% (251155/457809)
Branch Coverage 56.37% (108538/192533)

@englefly
englefly force-pushed the decouple-rf branch 2 times, most recently from 6d0e79f to b263279 Compare May 19, 2026 06:57
@englefly

Copy link
Copy Markdown
Contributor Author

/review

@englefly

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 78.06% (1854/2375)
Line Coverage 64.51% (33322/51653)
Region Coverage 65.17% (16512/25335)
Branch Coverage 55.71% (8829/15848)

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 30866 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b2632799f69c154be7010d477b91ae8a01b8fd18, data reload: false

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17656	3941	3927	3927
q2	q3	10933	1435	820	820
q4	4804	480	357	357
q5	9534	1859	1567	1567
q6	355	179	136	136
q7	918	836	647	647
q8	10990	1609	1685	1609
q9	7621	5464	5404	5404
q10	6880	1755	1495	1495
q11	444	268	245	245
q12	644	437	302	302
q13	18192	3532	2788	2788
q14	266	257	243	243
q15	q16	818	797	701	701
q17	1017	973	924	924
q18	7059	5751	5588	5588
q19	1190	1242	1099	1099
q20	530	416	267	267
q21	5709	2642	2442	2442
q22	428	354	305	305
Total cold run time: 105988 ms
Total hot run time: 30866 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4234	4141	4174	4141
q2	q3	4522	4910	4360	4360
q4	2107	2208	1396	1396
q5	4449	4484	5151	4484
q6	249	191	145	145
q7	1991	1755	1603	1603
q8	2458	2174	2074	2074
q9	7751	7803	7895	7803
q10	4776	4446	4063	4063
q11	631	415	380	380
q12	718	744	520	520
q13	3306	3636	3036	3036
q14	307	302	272	272
q15	q16	728	768	655	655
q17	1343	1324	1317	1317
q18	7985	7305	7031	7031
q19	1134	1114	1097	1097
q20	2216	2214	1930	1930
q21	5389	4657	4547	4547
q22	523	470	415	415
Total cold run time: 56817 ms
Total hot run time: 51269 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 167488 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit b2632799f69c154be7010d477b91ae8a01b8fd18, data reload: false

query5	4317	651	511	511
query6	347	218	213	213
query7	4223	582	311	311
query8	326	238	216	216
query9	8806	4016	4007	4007
query10	506	339	304	304
query11	5400	2108	1975	1975
query12	191	134	132	132
query13	1285	614	430	430
query14	6019	5457	5093	5093
query14_1	4417	4369	4360	4360
query15	218	205	187	187
query16	1017	469	468	468
query17	1182	762	619	619
query18	2573	513	367	367
query19	224	217	182	182
query20	145	137	136	136
query21	216	143	118	118
query22	13688	13586	13403	13403
query23	17393	16406	16052	16052
query23_1	16131	16090	16158	16090
query24	7693	1788	1360	1360
query24_1	1322	1293	1318	1293
query25	571	477	422	422
query26	1330	316	168	168
query27	2666	556	337	337
query28	4404	1989	1928	1928
query29	965	632	507	507
query30	317	253	191	191
query31	1145	1080	928	928
query32	89	76	74	74
query33	526	366	315	315
query34	1171	1142	645	645
query35	763	777	675	675
query36	1348	1354	1184	1184
query37	156	107	94	94
query38	3232	3129	3056	3056
query39	930	923	910	910
query39_1	885	880	887	880
query40	231	156	126	126
query41	66	64	66	64
query42	116	114	111	111
query43	323	323	294	294
query44	
query45	211	202	193	193
query46	1053	1177	739	739
query47	2272	2278	2197	2197
query48	398	407	291	291
query49	634	490	392	392
query50	961	379	247	247
query51	4297	4298	4271	4271
query52	106	108	96	96
query53	259	284	201	201
query54	314	277	262	262
query55	94	91	84	84
query56	294	312	304	304
query57	1394	1405	1319	1319
query58	302	282	264	264
query59	1519	1636	1447	1447
query60	324	321	320	320
query61	163	161	155	155
query62	676	636	558	558
query63	254	210	211	210
query64	2473	824	670	670
query65	
query66	1731	492	359	359
query67	30094	30003	29781	29781
query68	
query69	473	350	312	312
query70	982	1006	986	986
query71	304	281	264	264
query72	2905	2715	2379	2379
query73	862	742	433	433
query74	4008	3848	3654	3654
query75	2693	2698	2261	2261
query76	2327	1101	795	795
query77	404	413	336	336
query78	12101	12075	11715	11715
query79	1233	1122	747	747
query80	593	546	464	464
query81	451	278	236	236
query82	240	161	129	129
query83	281	278	253	253
query84	262	142	106	106
query85	816	531	448	448
query86	372	333	355	333
query87	3359	3331	3214	3214
query88	3590	2698	2659	2659
query89	429	388	338	338
query90	2162	181	178	178
query91	174	165	139	139
query92	80	80	77	77
query93	1540	1498	855	855
query94	510	339	296	296
query95	668	391	362	362
query96	1016	754	355	355
query97	2744	2706	2578	2578
query98	232	234	234	234
query99	1099	1113	978	978
Total cold run time: 249295 ms
Total hot run time: 167488 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 94.23% (49/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.56% (20735/38714)
Line Coverage 37.21% (196123/527138)
Region Coverage 33.53% (153652/458319)
Branch Coverage 34.58% (66985/193708)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 96.15% (50/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 63.41% (24043/37916)
Line Coverage 47.15% (247906/525785)
Region Coverage 44.14% (204259/462740)
Branch Coverage 45.39% (88251/194435)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 58.37% (143/245) 🎉
Increment coverage report
Complete coverage report

@englefly

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 31265 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d680f098875f35b7474c2723a7f5daebf2eb3da8, data reload: false

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17789	4091	3965	3965
q2	q3	10967	1434	808	808
q4	4752	477	351	351
q5	9304	1856	1565	1565
q6	321	182	143	143
q7	891	874	659	659
q8	10960	1582	1562	1562
q9	7680	5371	5387	5371
q10	6821	1824	1537	1537
q11	441	271	259	259
q12	648	428	289	289
q13	18096	3438	2806	2806
q14	262	250	237	237
q15	q16	809	787	721	721
q17	1008	924	991	924
q18	6834	5777	6213	5777
q19	1225	1398	1072	1072
q20	542	424	276	276
q21	5914	2766	2630	2630
q22	457	382	313	313
Total cold run time: 105721 ms
Total hot run time: 31265 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4750	4529	4636	4529
q2	q3	4900	5310	4597	4597
q4	2117	2204	1443	1443
q5	4924	4660	4706	4660
q6	242	177	134	134
q7	1865	1725	1502	1502
q8	2471	2012	1964	1964
q9	7311	7276	7289	7276
q10	4483	4402	3990	3990
q11	538	391	359	359
q12	710	717	507	507
q13	3038	3363	2808	2808
q14	276	274	251	251
q15	q16	692	696	608	608
q17	1268	1285	1248	1248
q18	7449	7038	7008	7008
q19	1154	1104	1120	1104
q20	2239	2242	1931	1931
q21	5348	4761	4520	4520
q22	551	466	400	400
Total cold run time: 56326 ms
Total hot run time: 50839 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 167220 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit d680f098875f35b7474c2723a7f5daebf2eb3da8, data reload: false

query5	4414	676	535	535
query6	340	238	217	217
query7	4247	576	305	305
query8	346	252	237	237
query9	8859	4113	4081	4081
query10	459	344	313	313
query11	5369	2074	1944	1944
query12	182	134	129	129
query13	1283	601	451	451
query14	6081	5461	5122	5122
query14_1	4414	4408	4375	4375
query15	216	207	190	190
query16	1028	471	482	471
query17	1166	767	610	610
query18	2752	492	364	364
query19	230	211	179	179
query20	141	133	131	131
query21	219	151	121	121
query22	13656	13543	13349	13349
query23	17413	16344	16008	16008
query23_1	16107	16193	16194	16193
query24	7427	1813	1309	1309
query24_1	1349	1312	1343	1312
query25	586	526	446	446
query26	1320	346	176	176
query27	2622	583	346	346
query28	4404	1992	1985	1985
query29	1015	624	493	493
query30	296	233	198	198
query31	1127	1065	949	949
query32	95	77	74	74
query33	530	348	325	325
query34	1159	1117	643	643
query35	776	775	678	678
query36	1294	1301	1117	1117
query37	150	109	89	89
query38	3237	3146	3052	3052
query39	924	953	897	897
query39_1	876	878	875	875
query40	236	144	129	129
query41	67	65	61	61
query42	117	113	109	109
query43	329	323	285	285
query44	
query45	213	205	201	201
query46	1080	1156	720	720
query47	2303	2318	2153	2153
query48	415	441	297	297
query49	636	489	381	381
query50	1003	355	255	255
query51	4335	4262	4211	4211
query52	107	106	96	96
query53	253	284	211	211
query54	313	270	286	270
query55	93	95	86	86
query56	296	316	308	308
query57	1414	1363	1309	1309
query58	303	278	259	259
query59	1605	1702	1456	1456
query60	321	328	314	314
query61	187	151	157	151
query62	676	645	580	580
query63	240	205	219	205
query64	2428	810	660	660
query65	
query66	1696	490	359	359
query67	30024	29967	29326	29326
query68	
query69	472	350	318	318
query70	1062	1037	1022	1022
query71	323	287	276	276
query72	3042	2958	2457	2457
query73	835	766	434	434
query74	4019	3843	3666	3666
query75	2701	2595	2267	2267
query76	2308	1167	797	797
query77	420	426	344	344
query78	12398	12124	11748	11748
query79	1288	1177	711	711
query80	603	542	459	459
query81	457	290	241	241
query82	238	164	125	125
query83	269	279	247	247
query84	249	141	108	108
query85	880	538	452	452
query86	361	327	311	311
query87	3359	3358	3202	3202
query88	3561	2646	2635	2635
query89	440	388	337	337
query90	2220	188	199	188
query91	175	173	140	140
query92	82	81	72	72
query93	1442	1565	849	849
query94	523	353	316	316
query95	697	378	449	378
query96	1095	775	346	346
query97	2702	2709	2594	2594
query98	239	243	227	227
query99	1088	1092	972	972
Total cold run time: 250003 ms
Total hot run time: 167220 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 94.23% (49/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.59% (20748/38714)
Line Coverage 37.24% (196315/527140)
Region Coverage 33.58% (153885/458319)
Branch Coverage 34.62% (67059/193707)

@englefly

Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. I found one additional blocker beyond the already-open review threads: the new decoupled runtime filter path is enabled by default and introduces an FE-to-BE semantic change (expr_order = -1) that old BEs do not understand, so rolling upgrade can crash or fail queries.

Critical checkpoint conclusions:

  • Goal/test proof: the PR aims to add decoupled runtime filters and includes FE/BE unit/regression coverage, but the coverage does not address mixed-version FE/BE compatibility.
  • Scope/focus: implementation is mostly focused on runtime filter generation/translation/execution, but default enablement expands blast radius.
  • Concurrency/lifecycle: no new thread lifecycle issue found in the reviewed paths; runtime filter wait semantics still have existing open review threads.
  • Configuration: new session variables are added; default enable_decoupled_runtime_filter=true is unsafe without backend capability gating.
  • Compatibility: blocking issue found for rolling upgrade because old BE indexes build_expr_ctxs[expr_order] and cannot handle -1.
  • Parallel paths: Nereids FE and BE hash-join runtime-filter paths were reviewed; existing open threads already cover expression mapping, wait-time grouping, and const-column materialization issues.
  • Tests/results: tests were added, but they do not cover old-BE compatibility or mixed-version behavior.
  • Observability/performance: no additional observability blocker found; performance gating by target row count is present.
  • User focus: no additional user-provided review focus was supplied.

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 78.06% (1854/2375)
Line Coverage 64.53% (33336/51663)
Region Coverage 65.23% (16530/25343)
Branch Coverage 55.73% (8835/15854)

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29004 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 97402cd89909d0ec555b5bb34adfca201607e3e4, data reload: false

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17687	4176	4114	4114
q2	q3	10767	1389	826	826
q4	4685	475	344	344
q5	7558	865	596	596
q6	183	176	138	138
q7	805	870	617	617
q8	9447	1559	1664	1559
q9	6263	4534	4429	4429
q10	6781	1826	1547	1547
q11	450	289	245	245
q12	634	433	307	307
q13	18197	3420	2759	2759
q14	284	276	240	240
q15	q16	823	780	717	717
q17	993	955	935	935
q18	7338	5804	5681	5681
q19	2310	1275	1046	1046
q20	521	404	264	264
q21	5935	2626	2332	2332
q22	431	353	308	308
Total cold run time: 102092 ms
Total hot run time: 29004 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4522	4424	4460	4424
q2	q3	4561	4956	4332	4332
q4	2090	2222	1575	1575
q5	4475	4347	4411	4347
q6	235	180	132	132
q7	2109	1869	1771	1771
q8	2711	2314	2334	2314
q9	8073	7978	8053	7978
q10	4816	4770	4318	4318
q11	608	455	520	455
q12	747	754	540	540
q13	3264	3611	2952	2952
q14	305	319	292	292
q15	q16	725	759	679	679
q17	1356	1349	1376	1349
q18	8073	7425	7203	7203
q19	1127	1093	1157	1093
q20	2241	2248	1955	1955
q21	5259	4664	4515	4515
q22	515	465	407	407
Total cold run time: 57812 ms
Total hot run time: 52631 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 172852 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 97402cd89909d0ec555b5bb34adfca201607e3e4, data reload: false

query5	4354	662	542	542
query6	341	222	204	204
query7	4227	570	319	319
query8	335	232	227	227
query9	8815	4135	4109	4109
query10	454	365	300	300
query11	5789	2397	2266	2266
query12	189	127	133	127
query13	1285	586	449	449
query14	6175	5476	5202	5202
query14_1	4479	4520	4476	4476
query15	215	209	185	185
query16	1045	473	423	423
query17	1124	735	591	591
query18	2684	489	348	348
query19	219	207	168	168
query20	141	136	133	133
query21	222	137	123	123
query22	13769	13661	13558	13558
query23	17452	16588	16251	16251
query23_1	16256	16331	16374	16331
query24	7472	1783	1313	1313
query24_1	1346	1306	1341	1306
query25	598	507	445	445
query26	1335	327	170	170
query27	2677	563	362	362
query28	4438	2015	2031	2015
query29	1015	650	519	519
query30	322	237	200	200
query31	1146	1088	971	971
query32	89	80	79	79
query33	549	375	312	312
query34	1196	1152	677	677
query35	777	799	722	722
query36	1415	1441	1274	1274
query37	156	105	103	103
query38	3251	3192	3076	3076
query39	943	912	908	908
query39_1	886	913	889	889
query40	245	153	133	133
query41	73	70	70	70
query42	114	113	121	113
query43	332	334	308	308
query44	
query45	220	208	203	203
query46	1099	1202	743	743
query47	2405	2384	2244	2244
query48	424	423	309	309
query49	657	511	418	418
query50	1025	368	263	263
query51	4350	4364	4310	4310
query52	113	109	101	101
query53	270	285	207	207
query54	339	307	287	287
query55	97	94	91	91
query56	329	320	315	315
query57	1467	1420	1329	1329
query58	310	288	280	280
query59	1580	1692	1416	1416
query60	334	333	324	324
query61	185	214	159	159
query62	711	654	596	596
query63	248	211	215	211
query64	2350	826	629	629
query65	
query66	1701	468	371	371
query67	29761	29764	29631	29631
query68	
query69	468	341	332	332
query70	1005	1026	952	952
query71	301	276	262	262
query72	3013	2719	2526	2526
query73	863	784	473	473
query74	5125	4957	4811	4811
query75	2687	2608	2263	2263
query76	2242	1124	743	743
query77	410	416	338	338
query78	12560	12460	11941	11941
query79	1502	1000	758	758
query80	1319	532	474	474
query81	517	278	243	243
query82	1270	156	126	126
query83	347	280	242	242
query84	266	142	114	114
query85	925	557	471	471
query86	447	315	340	315
query87	3446	3386	3231	3231
query88	3625	2794	2781	2781
query89	452	392	351	351
query90	1880	191	189	189
query91	185	168	143	143
query92	79	74	73	73
query93	1473	1533	971	971
query94	742	343	326	326
query95	675	408	463	408
query96	1066	797	348	348
query97	2744	2740	2576	2576
query98	239	226	225	225
query99	1157	1162	1016	1016
Total cold run time: 255568 ms
Total hot run time: 172852 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 96.36% (53/55) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.83% (28126/38097)
Line Coverage 57.83% (305879/528973)
Region Coverage 55.05% (256269/465485)
Branch Coverage 56.53% (110644/195740)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 72.20% (148/205) 🎉
Increment coverage report
Complete coverage report

@englefly

Copy link
Copy Markdown
Contributor Author

run cloud_p0

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 96.36% (53/55) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.83% (28126/38097)
Line Coverage 57.83% (305879/528973)
Region Coverage 55.05% (256269/465485)
Branch Coverage 56.53% (110644/195740)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 63.52% (148/233) 🎉
Increment coverage report
Complete coverage report

@englefly
englefly marked this pull request as ready for review June 1, 2026 02:06
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jun 1, 2026
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@englefly
englefly merged commit 679081e into apache:master Jun 1, 2026
34 of 35 checks passed
@englefly
englefly deleted the decouple-rf branch June 1, 2026 08:12
zhaorongsheng pushed a commit to zhaorongsheng/doris that referenced this pull request Jun 4, 2026
…e#62737)

### What problem does this PR solve?
support decoupled rf.
(A join B) join (C join D)
decoupled rf: B->C and B->D

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [ ] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->

---------

Co-authored-by: Copilot <[email protected]>

@morrySnow morrySnow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Decoupled Runtime Filter (#62737)

This PR adds decoupled runtime filter support, allowing RF producers and predicate sources to be on different join nodes. The feature is well-structured with FE planning/decision logic and BE execution support. Below are the findings from a thorough review.

🟡 Correctness Concerns

1. Dead code: RuntimeFilterContext.removeRuntimeFilter() is never called

  • File: fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java, line 140
  • Summary: The new removeRuntimeFilter(RuntimeFilter rf) method performs full cleanup across all data structures (target scans, targetExprIdToFilter, builder node, joinToTargetExprId), but it is never invoked anywhere in the codebase. A grep for removeRuntimeFilter across the entire fe/ directory returns only the method definition. If this was intended as part of a removal path for decoupled RFs, the call site is missing. If it's dead code, it adds 24 lines of untested maintenance surface.
  • Fix: Either add the intended call site or remove the method (annotate with @VisibleForTesting if it's reserved for tests).

2. hasFilterInSubtree is called twice on the same subtree redundantly

  • File: fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java, lines 508 and 563
  • Summary: In generateDecoupledRuntimeFilters(), hasFilterInSubtree(decoupledBuilder.right()) is called at line 508 for pruning, and if it returns true, the result is immediately discarded; the method is called again at line 563 inside shouldPreferDecoupledRf(). This doubles the subtree traversal cost for every decoupled RF candidate in the unknown-stats path. hasFilterInSubtree recursively walks every node in the subtree — O(subtree_size).
  • Fix: Cache the hasFilterInSubtree result from line 508 in a local boolean and pass it to shouldPreferDecoupledRf, or restructure to avoid the duplicate call.

🟡 Code Quality Issues

3. Encapsulation break: runtimeFilterWaitInfinitely made public

  • File: fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java, line 1750
  • Summary: The field runtimeFilterWaitInfinitely was changed from private to public to allow direct access from RuntimeFilterTranslator.setWaitTimeMs(). However, a public getter method already exists and should have been used instead. Direct field access breaks encapsulation — any code can now modify this session variable without going through the getter/setter pattern used by all other SessionVariable fields.
  • Fix: Revert the visibility change to private and use the existing getter method in RuntimeFilterTranslator.setWaitTimeMs().

4. Copy-paste duplication: markDecoupledRfAsNonBlocking and markStandardRfAsNonBlocking are ~85% identical

  • File: fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java, lines 603-615 and 618-631
  • Summary: Both methods iterate runtime filters, match on the same four fields (exprOrder, builderNode, srcExpr, type), and call rf.setNonBlocking(true). The only differences are: (1) the collection iterated over (targetExprIdToFilter.values() vs getNereidsRuntimeFilter()), and (2) the exprOrder match (== -1 constant vs == exprOrder parameter). Both are called within the same loop iteration at lines 538/540. Any change to the matching logic must be applied identically to both.
  • Fix: Extract a shared helper:
    private void markRfAsNonBlocking(Collection<RuntimeFilter> filters,
            int expectedExprOrder, Plan builderNode, Expression srcExpr, TRuntimeFilterType type)

5. Magic number: exprOrder == -1 sentinel scattered without a named constant

  • Files: RuntimeFilterGenerator.java, RuntimeFilterPushDownVisitor.java, RuntimeFilter.java (planner), RuntimeFilterTranslator.java, runtime_filter_producer_helper.cpp
  • Summary: The value -1 is used as a sentinel for decoupled runtime filters in at least 6 files, across both FE (Java) and BE (C++). There is no named constant, no enum value, and no centralized documentation. Every new code path that processes runtime filters must remember to check exprOrder >= 0 before indexing into equi-conjunct lists. A missed check produces an IndexOutOfBoundsException or silent wrong behavior.
  • Fix: Define a constant, e.g., public static final int DECOUPLED_RF_EXPR_ORDER = -1, and use it consistently.

🟢 Minor Observations

6. findBuilderForDecoupledRf/ tryFindDeeperBuilder use hard-coded instanceof chains

  • File: fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java, lines 641-678 and 692-730
  • Summary: These methods handle AbstractPhysicalJoin, PhysicalProject, PhysicalDistribute, and PhysicalFilter with explicit instanceof checks. Any new plan node type introduced in the future (e.g., PhysicalSort in the probe path, PhysicalWindow, a new exchange operator) would cause these methods to silently return null, skipping a decoupled RF opportunity with no warning. The traversal should either use a generic visitor pattern or fall through with a transparent pass-through for unknown node types.

7. _decoupled_filter_indices is redundant state

  • File: be/src/exec/runtime_filter/runtime_filter_producer_helper.h, line 214
  • Summary: The _decoupled_filter_indices vector stores indices that could be derived on-the-fly from the original runtime_filter_descs (checking expr_order < 0). Maintaining it in parallel with _filter_expr_contexts is a consistency risk — if a future code path modifies one vector without updating the other, the two would desynchronize.

No blockers found — the PR's core logic is sound and the changes are well-tested with both unit tests and regression tests. The issues above are cleanup/robustness improvements.

@morrySnow

Copy link
Copy Markdown
Contributor

Inline Review Comments

1. Dead code — fe/.../RuntimeFilterContext.java (new method around diff line 386)

The new removeRuntimeFilter(RuntimeFilter rf) method is defined but never called anywhere in the codebase. Grep across the entire fe/ directory confirms only the definition exists. If this was intended for decoupled RF cleanup when preferDecoupled == true, the call site is missing. If unused, it's untested dead code.

2. Encapsulation break — fe/.../SessionVariable.java (diff line 1750)

runtimeFilterWaitInfinitely was changed from private to public. A public getter method already exists — the new code in RuntimeFilterTranslator.setWaitTimeMs() should use it instead of direct field access.

3. Redundant work — fe/.../RuntimeFilterGenerator.java (diff lines 508 and 563)

hasFilterInSubtree(decoupledBuilder.right()) is called at line 508 for pruning, and if it returns true, the same subtree is walked again at line 563 inside shouldPreferDecoupledRf(). The result from line 508 should be cached and reused.

4. Code clones — fe/.../RuntimeFilterGenerator.java (diff lines 476 and 491)

markDecoupledRfAsNonBlocking() and markStandardRfAsNonBlocking() are ~85% identical — both iterate filters matching on the same four fields. Consider extracting a shared helper.

5. Magic number — multiple files

exprOrder == -1 is used as a sentinel for decoupled RFs in 6+ files (FE Java and BE C++). No named constant exists. Define DECOUPLED_RF_EXPR_ORDER = -1 to document the sentinel and prevent accidental misuse.

6. Latent issue — be/.../runtime_filter_producer_helper_cross.h (diff line 229)

_init_expr override copies all build_expr_ctxs into _filter_expr_contexts without sizing to runtime_filter_descs.size(). If a decoupled RF reaches a cross-join builder, _insert() could dereference an out-of-bounds index. Currently latent but generateDecoupledRuntimeFilters explicitly allows cross joins.

@morrySnow

Copy link
Copy Markdown
Contributor

Correction to review item #6 (RuntimeFilterProducerHelperCross): After deeper verification, this finding is REFUTED. The cross-join path creates VExprContexts for ALL filter descriptors by position (nested_loop_join_build_operator.cpp lines 77-81 create _filter_src_expr_ctxs from _runtime_filter_descs[i].src_expr), and the Cross _init_expr override copies by position rather than indexing by expr_order. So a decoupled RF at position i correctly gets _filter_expr_contexts[i] = expression from desc i. The base class approach of indexing by expr_order would crash for expr_order == -1, but the Cross override avoids this entirely by position-based copying. No bug here.

Additionally, finding about hasFilterInSubtree missing pushed-down filters is also REFUTED: PhysicalFilter nodes are still present in the plan tree during the post-processing phase when hasFilterInSubtree runs.

englefly added a commit to englefly/incubator-doris that referenced this pull request Oct 12, 2026
…port (apache#62737)

### What problem does this PR solve?
support decoupled rf.
(A join B) join (C join D)
decoupled rf: B->C and B->D

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [ ] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->

---------

Co-authored-by: Copilot <[email protected]>
englefly added a commit to englefly/incubator-doris that referenced this pull request Oct 12, 2026
…decoupled runtime filter

Regenerated with -forceGenOut on branch-4.2 + apache#62737 after rebasing onto the
latest branch-4.2: tpcds_sf100 queries 4/11/31/32/74/92 (shape, no_stats_shape,
noStatsRfPrune, rf_prune), tpcds_sf1000 queries 4/11/24/30/32/81/92 (shape, hint)
and query4/11/24/30/81 in shape_check/tpcds_sf1000_constraints, tpcds_sf10t_orc
queries 4/11/18/31/32/54/74/92, tpch_sf1000 q8/q9 plus q2/q17/q18 in
shape/no_stats/nostats_rf_prune/rf_prune and q9 in tpch_sf1000_constraints.

Only runtime-filter annotations change (build RF target lists and applied RFs);
plan shapes, join distributions and predicates are unchanged.
englefly added a commit to englefly/incubator-doris that referenced this pull request Oct 13, 2026
…port (apache#62737)

support decoupled rf.
(A join B) join (C join D)
decoupled rf: B->C and B->D

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

None

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [ ] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->

---------

Co-authored-by: Copilot <[email protected]>
englefly added a commit to englefly/incubator-doris that referenced this pull request Oct 13, 2026
…decoupled runtime filter

Regenerated with -forceGenOut on branch-4.2 + apache#62737 after rebasing onto the
latest branch-4.2: tpcds_sf100 queries 4/11/31/32/74/92 (shape, no_stats_shape,
noStatsRfPrune, rf_prune), tpcds_sf1000 queries 4/11/24/30/32/81/92 (shape, hint)
and query4/11/24/30/81 in shape_check/tpcds_sf1000_constraints, tpcds_sf10t_orc
queries 4/11/18/31/32/54/74/92, tpch_sf1000 q8/q9 plus q2/q17/q18 in
shape/no_stats/nostats_rf_prune/rf_prune and q9 in tpch_sf1000_constraints.

Only runtime-filter annotations change (build RF target lists and applied RFs);
plan shapes, join distributions and predicates are unchanged.
yiguolei pushed a commit that referenced this pull request Oct 13, 2026
…port (#68212)

Cherry-pick of #62737 to branch-4.2

[feature](runtime filter) Add decoupled runtime filter support

Adaptations for branch-4.2:
* `RuntimeFilterConsumer` keeps branch-4.2's `wait_infinitely`
computation (no BITMAP_FILTER term) and wraps it in the new
`desc->__isset.wait_time_ms` branch.
* `RuntimeFilterTranslator`/generator call branch-4.2's
`PushDownContext.createPushDownContextForHashJoin` factory instead of
master's unified `createPushDownContext`.
* The three new session variables use branch-4.2's
`@VariableMgr.VarAttr`; `runtimeFilterWaitInfinitely` becomes public as
upstream requires.

Rebased onto the latest branch-4.2 (Variant relational-ops RF guards
merged into `RuntimeFilterPushDownVisitor`, new Variant RF unit tests
preserved in `RuntimeFilterTest`).

CI fixes:
* shape_check baselines regenerated with `-forceGenOut` for every case
that failed in P0 regression: tpcds_sf100 4/11/31/32/74/92 (shape,
no_stats_shape, noStatsRfPrune, rf_prune), tpcds_sf1000
4/11/24/30/32/81/92 (shape, hint), tpcds_sf1000_constraints
4/11/24/30/81, tpcds_sf10t_orc 4/11/18/31/32/54/74/92, tpch_sf1000
q2/q8/q9/q17/q18 (shape, shape_no_stats, nostats_rf_prune, rf_prune),
tpch_sf1000_constraints q9 and the dphyper variants tpcds_sf1000
query54/query72 and tpch_sf1000 q8/q9/q18. Every regenerated file
differs from the branch-4.2 baseline only in runtime-filter annotations
(build RF target lists and applied RFs); plan shapes, join distributions
and predicates are untouched. For the dphyper files the regenerated
lines match the mismatches reported by CI one by one.
* `RuntimeFilterTest#testDecoupledRuntimeFilter` now asserts the
branch-4.2 observable behaviour instead of a separate `exprOrder == -1`
filter. On branch-4.2
`RuntimeFilterContext#getRuntimeFilterBySrcAndType` identifies a filter
by (srcExpr, type, builderNode) only, so the decoupled RF is merged into
the standard RF of the builder join (master dedups per target scan
including exprOrder and keeps them apart). The test checks, with and
without the feature, that the join2 RF additionally targets
`supplier.s_suppkey` and that the join1 RF becomes non-blocking when the
decoupled RF is preferred.

Testing:
* `run-fe-ut.sh --run
org.apache.doris.nereids.postprocess.RuntimeFilterTest` -> Tests run:
33, Failures: 0, Errors: 0.
* regression suite `nereids_syntax_p0/decoupled_runtime_filter` passes.
* every shape_check suite touching a regenerated baseline passes locally
(tpcds_sf100/sf1000/sf1000_constraints/sf10t_orc,
tpch_sf1000/tpch_sf1000_constraints, including the dphyper suites). The
decoupled RFs are reproduced because the local cluster has the same
loaded tpcds/tpch data as CI.
* Unrelated red checks from the previous run: BE UT failures were
`FileCacheProfileReporterTest` (x3) and
`RegexGramRecallTest.DynamicPatternRegexExecution`, which are known
flaky and are muted in TeamCity (same tests muted on other PR builds),
and the NonConcurrent `FE IMAGE GENERATED FAIL / CHECKPOINT FAIL`
failure is infra-wide (identical failure on #68788).

---------

Signed-off-by: Aurélien Pupier <[email protected]>
Co-authored-by: Aurélien Pupier <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.2.0-merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants