Skip to content

[fix](be) Revert row id read batching#63544

Open
BiteTheDDDDt wants to merge 1 commit into
apache:masterfrom
BiteTheDDDDt:revert-rowid-batching-regression
Open

[fix](be) Revert row id read batching#63544
BiteTheDDDDt wants to merge 1 commit into
apache:masterfrom
BiteTheDDDDt:revert-rowid-batching-regression

Conversation

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #63436

Problem Summary: Revert #63436 because recent profiling shows the row id read path spending significant CPU in RleDecoder<bool>::GetNextRun, BitReader::GetValue/GetVlqInt, FileColumnIterator::read_by_rowids, BitShufflePageDecoder::read_by_rowids, and LZ4 decompression. The reverted change groups sparse row ids by segment and reads them in larger sorted batches. For sparse nullable columns this can make FileColumnIterator::read_by_rowids advance through large null-map ranges and spend more CPU in RLE/bit decoding. Restore the previous per-row and adjacent-file batching behavior while the sparse nullable row id access pattern is investigated.

Release note

None

Check List (For Author)

  • Test: Manual test
    • build-support/check-format.sh be/src/exec/rowid_fetcher.cpp be/src/service/point_query_executor.cpp be/src/storage/segment/segment.cpp be/src/storage/segment/segment.h
    • ninja -C be/build_Release src/exec/CMakeFiles/Exec.dir/rowid_fetcher.cpp.o src/service/CMakeFiles/Service.dir/point_query_executor.cpp.o src/storage/CMakeFiles/Storage.dir/segment/segment.cpp.o
  • Behavior changed: Yes. Restore row id fetch behavior before [opt](be) Batch row_id reads in seek_and_read_by_rowid to reduce column iterator overhead #63436.
  • Does this need documentation: No

### What problem does this PR solve?

Issue Number: None

Related PR: apache#63436

Problem Summary: Revert the row id fetch batching change from apache#63436 because recent profiling shows the row id read path spending significant CPU in nullable null-map RLE decoding and bit readers after the batching change. The reverted change groups sparse row ids by segment and reads them in larger sorted batches, which can make FileColumnIterator::read_by_rowids advance through large null-map ranges for sparse nullable columns. Restore the previous per-row and adjacent-file batching behavior while the sparse nullable row id access pattern is investigated.

### Release note

None

### Check List (For Author)

- Test: Manual test

    - build-support/check-format.sh be/src/exec/rowid_fetcher.cpp be/src/service/point_query_executor.cpp be/src/storage/segment/segment.cpp be/src/storage/segment/segment.h

    - ninja -C be/build_Release src/exec/CMakeFiles/Exec.dir/rowid_fetcher.cpp.o src/service/CMakeFiles/Service.dir/point_query_executor.cpp.o src/storage/CMakeFiles/Storage.dir/segment/segment.cpp.o

- Behavior changed: Yes. Restore the row id fetch behavior before apache#63436.

- Does this need documentation: No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 11:44
@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?

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 31320 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 62d42cfc9ba5caa0d4cf1602b96244a28743e9f4, 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	17720	3905	3995	3905
q2	q3	10782	1457	855	855
q4	4711	472	346	346
q5	7993	2267	2113	2113
q6	379	171	136	136
q7	980	789	637	637
q8	9401	1758	1777	1758
q9	7151	4915	4932	4915
q10	6443	2101	1802	1802
q11	437	288	244	244
q12	700	428	292	292
q13	18189	3935	2780	2780
q14	261	256	233	233
q15	q16	827	763	701	701
q17	1028	943	1010	943
q18	6910	5697	5603	5603
q19	1172	1375	1106	1106
q20	494	431	261	261
q21	5661	2636	2387	2387
q22	435	369	303	303
Total cold run time: 101674 ms
Total hot run time: 31320 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	4193	4091	4127	4091
q2	q3	4538	4952	4324	4324
q4	2089	2371	1392	1392
q5	4387	4247	4747	4247
q6	245	199	142	142
q7	1981	1866	1624	1624
q8	2524	2208	2200	2200
q9	7805	7862	7814	7814
q10	4580	4469	4216	4216
q11	583	404	367	367
q12	755	778	515	515
q13	3263	3739	3002	3002
q14	303	300	283	283
q15	q16	739	729	667	667
q17	1393	1382	1319	1319
q18	8060	7407	6793	6793
q19	1130	1106	1145	1106
q20	2228	2211	1952	1952
q21	5309	4616	4543	4543
q22	514	457	405	405
Total cold run time: 56619 ms
Total hot run time: 51002 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 30647 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 62d42cfc9ba5caa0d4cf1602b96244a28743e9f4, 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	17737	3900	3901	3900
q2	q3	10774	1367	814	814
q4	4684	474	346	346
q5	7673	2237	2069	2069
q6	238	170	135	135
q7	932	780	638	638
q8	9410	1589	1526	1526
q9	6297	4891	4870	4870
q10	6444	2102	1791	1791
q11	436	272	245	245
q12	698	419	289	289
q13	18228	3403	2797	2797
q14	268	248	233	233
q15	q16	814	778	712	712
q17	1043	963	921	921
q18	6785	5674	5499	5499
q19	1256	1298	1017	1017
q20	490	400	262	262
q21	5673	2558	2288	2288
q22	442	360	295	295
Total cold run time: 100322 ms
Total hot run time: 30647 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	4182	4122	4114	4114
q2	q3	4492	4907	4286	4286
q4	2073	2209	1364	1364
q5	4414	4229	4263	4229
q6	222	176	125	125
q7	1817	2067	1681	1681
q8	2471	2126	2023	2023
q9	7846	7646	7750	7646
q10	4533	4471	4089	4089
q11	556	417	398	398
q12	735	742	512	512
q13	3418	3635	3059	3059
q14	306	309	287	287
q15	q16	710	761	719	719
q17	1318	1286	1283	1283
q18	8027	7314	7250	7250
q19	1131	1112	1113	1112
q20	2209	2208	1924	1924
q21	5289	4603	4417	4417
q22	508	454	401	401
Total cold run time: 56257 ms
Total hot run time: 50919 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 169473 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 62d42cfc9ba5caa0d4cf1602b96244a28743e9f4, data reload: false

query5	4370	638	526	526
query6	330	213	200	200
query7	4239	570	299	299
query8	322	228	216	216
query9	8846	4017	4001	4001
query10	459	340	295	295
query11	5778	2364	2196	2196
query12	183	125	121	121
query13	1278	582	436	436
query14	5957	5361	5036	5036
query14_1	4343	4302	4313	4302
query15	205	202	184	184
query16	982	441	344	344
query17	1116	715	578	578
query18	2430	476	354	354
query19	209	195	166	166
query20	135	141	134	134
query21	214	138	115	115
query22	13592	13525	13290	13290
query23	17142	16281	16044	16044
query23_1	16113	16149	16128	16128
query24	7390	1766	1293	1293
query24_1	1305	1339	1288	1288
query25	560	467	433	433
query26	1327	328	178	178
query27	2669	567	351	351
query28	4516	2018	1940	1940
query29	994	612	499	499
query30	306	241	199	199
query31	1098	1072	930	930
query32	98	74	72	72
query33	535	343	286	286
query34	1210	1140	646	646
query35	774	771	664	664
query36	1341	1323	1153	1153
query37	147	99	90	90
query38	3195	3141	3032	3032
query39	931	908	920	908
query39_1	885	884	906	884
query40	231	145	121	121
query41	65	63	61	61
query42	110	109	108	108
query43	318	322	290	290
query44	
query45	211	201	195	195
query46	1101	1210	730	730
query47	2349	2354	2167	2167
query48	357	410	287	287
query49	627	492	386	386
query50	925	338	254	254
query51	4365	4307	4296	4296
query52	106	106	95	95
query53	250	275	199	199
query54	303	295	246	246
query55	98	91	88	88
query56	295	297	295	295
query57	1412	1399	1290	1290
query58	298	277	267	267
query59	1574	1632	1419	1419
query60	317	314	321	314
query61	183	181	178	178
query62	666	625	554	554
query63	242	201	207	201
query64	2506	856	693	693
query65	
query66	1736	490	367	367
query67	29974	30307	30330	30307
query68	
query69	498	386	320	320
query70	1017	992	1008	992
query71	302	270	267	267
query72	3081	2968	2471	2471
query73	842	783	436	436
query74	5058	4880	4723	4723
query75	2658	2576	2282	2282
query76	2297	1151	754	754
query77	393	414	326	326
query78	12135	12185	11747	11747
query79	1493	1026	713	713
query80	656	537	442	442
query81	457	275	242	242
query82	1375	152	127	127
query83	347	271	253	253
query84	263	137	105	105
query85	909	534	447	447
query86	399	346	303	303
query87	3413	3440	3183	3183
query88	3544	2653	2654	2653
query89	442	381	331	331
query90	2004	185	180	180
query91	172	170	145	145
query92	84	80	70	70
query93	1607	1470	817	817
query94	524	348	296	296
query95	669	479	349	349
query96	1033	805	315	315
query97	2664	2714	2588	2588
query98	234	234	227	227
query99	1125	1108	974	974
Total cold run time: 252812 ms
Total hot run time: 169473 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 169051 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 62d42cfc9ba5caa0d4cf1602b96244a28743e9f4, data reload: false

query5	4306	645	533	533
query6	328	216	199	199
query7	4266	588	307	307
query8	319	233	216	216
query9	8833	4023	4019	4019
query10	446	346	303	303
query11	5839	3216	2190	2190
query12	184	129	129	129
query13	1304	631	440	440
query14	6060	5366	5047	5047
query14_1	4374	4399	4293	4293
query15	212	205	181	181
query16	1005	449	439	439
query17	1124	696	578	578
query18	2659	477	346	346
query19	205	195	156	156
query20	136	126	126	126
query21	214	138	114	114
query22	13654	13852	13587	13587
query23	17319	16356	16021	16021
query23_1	16117	16127	16077	16077
query24	7444	1787	1308	1308
query24_1	1292	1315	1303	1303
query25	588	488	403	403
query26	1336	348	172	172
query27	2665	532	340	340
query28	4415	1947	1972	1947
query29	1024	621	483	483
query30	308	234	203	203
query31	1117	1067	946	946
query32	87	73	74	73
query33	529	352	292	292
query34	1162	1088	644	644
query35	778	789	670	670
query36	1346	1317	1186	1186
query37	149	101	89	89
query38	3201	3100	3060	3060
query39	923	909	892	892
query39_1	881	878	877	877
query40	240	152	127	127
query41	66	63	63	63
query42	109	109	108	108
query43	322	324	284	284
query44	
query45	212	198	197	197
query46	1055	1189	715	715
query47	2299	2330	2173	2173
query48	394	413	290	290
query49	627	487	383	383
query50	986	331	243	243
query51	4332	4315	4209	4209
query52	102	104	95	95
query53	252	287	208	208
query54	305	279	265	265
query55	93	91	84	84
query56	307	314	296	296
query57	1393	1402	1282	1282
query58	299	264	263	263
query59	1549	1617	1399	1399
query60	323	324	320	320
query61	194	183	187	183
query62	673	626	568	568
query63	238	194	210	194
query64	2479	852	690	690
query65	
query66	1729	494	371	371
query67	30127	30046	29268	29268
query68	
query69	470	351	318	318
query70	1072	1023	977	977
query71	312	278	276	276
query72	3219	2730	2428	2428
query73	874	754	416	416
query74	5083	4952	4733	4733
query75	2661	2586	2235	2235
query76	2316	1107	723	723
query77	392	417	328	328
query78	11961	12268	11655	11655
query79	1481	1041	732	732
query80	1043	524	450	450
query81	503	277	239	239
query82	1382	156	121	121
query83	355	294	249	249
query84	264	144	110	110
query85	942	590	455	455
query86	457	309	319	309
query87	3461	3352	3227	3227
query88	3507	2679	2668	2668
query89	457	379	338	338
query90	1758	183	179	179
query91	174	168	145	145
query92	78	79	76	76
query93	1508	1408	799	799
query94	635	306	303	303
query95	647	379	350	350
query96	1035	739	310	310
query97	2698	2685	2555	2555
query98	235	228	226	226
query99	1102	1122	1021	1021
Total cold run time: 254032 ms
Total hot run time: 169051 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 93.48% (43/46) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.70% (27934/37901)
Line Coverage 57.56% (303085/526522)
Region Coverage 54.55% (252759/463384)
Branch Coverage 56.18% (109465/194853)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants