Skip to content

[refactor](be) Remove scanner eos flag#63578

Open
mrhhsg wants to merge 1 commit into
apache:masterfrom
mrhhsg:codex/remove-scanner-alreay-eos
Open

[refactor](be) Remove scanner eos flag#63578
mrhhsg wants to merge 1 commit into
apache:masterfrom
mrhhsg:codex/remove-scanner-alreay-eos

Conversation

@mrhhsg
Copy link
Copy Markdown
Member

@mrhhsg mrhhsg commented May 25, 2026

What changed

Remove the extra _alreay_eos scanner state from the scan projection path.

When get_block() reports eos while both _padding_block and the final _origin_block contain data, the projection path now merges them directly and returns eos=true in the same call. This can make only the final output block larger than the normal batch target, but each source block is already bounded by the lower scanner.

Why

_alreay_eos only existed to carry the final eos handoff across calls, and it also carried a typo in the member name. Merging the final padding/origin blocks at eos removes that extra state and keeps the block lifecycle simpler without changing query results.

Validation

  • Formatted modified C++ files with build-support/run_clang_format.py using clang-format 16.
  • git diff --check
  • ninja -C be/ut_build_ASAN -j 1 src/exec/CMakeFiles/Exec.dir/scan/scanner.cpp.o test/CMakeFiles/doris_be_test.dir/exec/scan/scanner_late_arrival_rf_test.cpp.o
  • Attempted ./run-be-ut.sh --run -j 1 --filter=ScannerProjectionTest.merges_padding_block_when_limit_eos_without_extra_flag:ScannerLateArrivalRfTest.applied_rf_num_advances_after_late_arrival; the full BE UT target did not complete locally because it started a broad rebuild on the shared host and process-resource pressure was observed (fork: Resource temporarily unavailable).

Release note

None

@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?

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: The scan projection path used a misspelled `_alreay_eos` boolean only to remember that a final padding block had to be emitted after get_block() reported eos. The extra state is not needed: when get_block() reports eos, the projection path can merge the pending padding block and the final origin block directly, then return eos in the same call. This may make the final output block exceed the target batch size, but the lower scanner already bounds individual source blocks, and avoiding a delayed eos handoff keeps the state machine simpler. A targeted unit test covers the limit-eos case where both origin and padding blocks are pending.

### Release note

None

### Check List (For Author)

- Test: Unit Test / Compile check
    - Formatted modified C++ files with build-support/run_clang_format.py using clang-format 16.
    - `git diff --check`
    - `ninja -C be/ut_build_ASAN -j 1 src/exec/CMakeFiles/Exec.dir/scan/scanner.cpp.o test/CMakeFiles/doris_be_test.dir/exec/scan/scanner_late_arrival_rf_test.cpp.o`
    - Attempted `./run-be-ut.sh --run -j 1 --filter=ScannerProjectionTest.merges_padding_block_when_limit_eos_without_extra_flag:ScannerLateArrivalRfTest.applied_rf_num_advances_after_late_arrival`, but the full BE UT target did not complete locally because it started a broad rebuild on the shared host and process-resource pressure was observed (`fork: Resource temporarily unavailable`).
- Behavior changed: No query result behavior changed. Internal scanner block boundaries can change for the final eos block.
- Does this need documentation: No
@mrhhsg mrhhsg force-pushed the codex/remove-scanner-alreay-eos branch from 492ee1f to dad2510 Compare May 25, 2026 06:31
@mrhhsg
Copy link
Copy Markdown
Member Author

mrhhsg commented May 25, 2026

/review

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review completed. I found no blocking issues in the actual PR diff (scanner.cpp, scanner.h, and scanner_late_arrival_rf_test.cpp).

Critical checkpoint conclusions:

  • Goal and tests: The PR removes the delayed _alreay_eos state and returns the merged final projection block with eos=true; the new unit test covers the limit-EOS case with both padding and origin blocks pending.
  • Scope: The change is small and focused on the scanner projection path plus a targeted test.
  • Concurrency: No new shared state, locks, or thread handoff are introduced. The existing scheduler path can enqueue a non-empty block while marking the scanner EOS.
  • Lifecycle/static state: No new lifecycle-sensitive objects or static initialization dependencies.
  • Configuration/compatibility/protocol: No config, storage format, wire protocol, or compatibility changes.
  • Parallel paths: The non-projection path is unchanged; the changed path is specific to _output_row_descriptor projection handling.
  • Error handling: Existing Status propagation from get_block, _merge_padding_block, and projection execution is preserved.
  • Test coverage/results: Added focused BE unit coverage. I did not rerun tests during this automated review.
  • Observability/transactions/data writes: Not applicable; no new write path or observability requirement.
  • Performance: Final EOS block boundaries may be larger as described, but source blocks remain bounded and this removes an extra scanner state transition.

User focus points: No additional user-provided review focus was present.

@mrhhsg
Copy link
Copy Markdown
Member Author

mrhhsg commented May 25, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 31756 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit dad25106fa17c7d7e93541cd668242048aace0e5, 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	17725	4066	4052	4052
q2	q3	10784	1417	819	819
q4	4687	477	357	357
q5	7677	2324	2100	2100
q6	236	176	142	142
q7	952	812	645	645
q8	9351	1664	1610	1610
q9	5191	4998	4993	4993
q10	6375	2252	1885	1885
q11	440	280	242	242
q12	623	431	300	300
q13	18192	3410	2815	2815
q14	265	261	243	243
q15	q16	811	805	709	709
q17	977	947	949	947
q18	6937	5728	5706	5706
q19	1300	1294	1108	1108
q20	526	415	257	257
q21	6039	2593	2510	2510
q22	434	370	316	316
Total cold run time: 99522 ms
Total hot run time: 31756 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	4361	4273	4282	4273
q2	q3	4568	4960	4310	4310
q4	2135	2238	1427	1427
q5	4458	4342	4388	4342
q6	384	241	159	159
q7	2154	1965	1708	1708
q8	2597	2311	2207	2207
q9	8435	8013	7953	7953
q10	5029	4812	4387	4387
q11	603	434	392	392
q12	798	775	559	559
q13	3349	3707	3064	3064
q14	298	295	296	295
q15	q16	749	734	636	636
q17	1402	1507	1374	1374
q18	7877	7325	7479	7325
q19	1185	1102	1100	1100
q20	2230	2223	1938	1938
q21	5367	4651	4557	4557
q22	533	481	450	450
Total cold run time: 58512 ms
Total hot run time: 52456 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 171297 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 dad25106fa17c7d7e93541cd668242048aace0e5, data reload: false

query5	4319	658	527	527
query6	325	217	208	208
query7	4237	565	305	305
query8	332	238	223	223
query9	8878	4112	4072	4072
query10	470	345	304	304
query11	5757	2529	2228	2228
query12	182	129	124	124
query13	1302	645	444	444
query14	6218	5474	5195	5195
query14_1	4459	4488	4461	4461
query15	214	206	180	180
query16	984	442	415	415
query17	962	737	613	613
query18	2467	485	343	343
query19	210	194	163	163
query20	130	132	125	125
query21	217	137	121	121
query22	13750	13724	13353	13353
query23	17355	16449	16229	16229
query23_1	16363	16377	16361	16361
query24	7366	1794	1329	1329
query24_1	1316	1331	1310	1310
query25	594	510	453	453
query26	1367	326	177	177
query27	2652	559	346	346
query28	4502	2039	2007	2007
query29	1008	651	539	539
query30	307	246	206	206
query31	1165	1106	961	961
query32	88	82	74	74
query33	545	358	307	307
query34	1205	1183	668	668
query35	773	796	693	693
query36	1393	1431	1259	1259
query37	160	105	93	93
query38	3251	3199	3078	3078
query39	951	931	917	917
query39_1	884	888	877	877
query40	230	152	130	130
query41	72	71	67	67
query42	115	114	112	112
query43	337	339	295	295
query44	
query45	218	203	210	203
query46	1100	1202	728	728
query47	2387	2420	2275	2275
query48	414	424	302	302
query49	654	513	411	411
query50	1006	352	261	261
query51	4380	4305	4280	4280
query52	113	107	99	99
query53	252	282	208	208
query54	338	297	269	269
query55	95	97	88	88
query56	318	312	311	311
query57	1449	1438	1355	1355
query58	313	284	277	277
query59	1598	1655	1422	1422
query60	333	329	323	323
query61	184	216	153	153
query62	696	645	601	601
query63	250	205	202	202
query64	2423	802	642	642
query65	
query66	1710	483	363	363
query67	30060	29292	29842	29292
query68	
query69	464	353	302	302
query70	1061	1017	1034	1017
query71	304	272	285	272
query72	3015	2923	2444	2444
query73	874	747	424	424
query74	5156	4982	4793	4793
query75	2735	2626	2303	2303
query76	2312	1134	774	774
query77	420	417	334	334
query78	12411	12520	11870	11870
query79	1538	1073	771	771
query80	653	535	448	448
query81	453	283	250	250
query82	1369	156	122	122
query83	360	287	249	249
query84	311	138	109	109
query85	877	556	450	450
query86	413	365	313	313
query87	3434	3381	3248	3248
query88	3623	2734	2731	2731
query89	441	393	343	343
query90	2012	172	195	172
query91	178	174	144	144
query92	83	90	79	79
query93	1486	1589	824	824
query94	537	361	296	296
query95	678	373	429	373
query96	968	803	374	374
query97	2758	2741	2633	2633
query98	232	253	236	236
query99	1196	1168	1047	1047
Total cold run time: 255108 ms
Total hot run time: 171297 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 77.27% (17/22) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.81% (20877/38797)
Line Coverage 37.39% (197781/528932)
Region Coverage 33.70% (154991/459916)
Branch Coverage 34.70% (67485/194473)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 95.45% (21/22) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.86% (28059/37987)
Line Coverage 57.80% (304905/527483)
Region Coverage 54.97% (255138/464157)
Branch Coverage 56.53% (110310/195123)

@mrhhsg mrhhsg marked this pull request as ready for review May 26, 2026 06:42
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.

2 participants