Skip to content

[feature](be) Add OLAP scan filter profile counters#64165

Open
BiteTheDDDDt wants to merge 4 commits into
apache:masterfrom
BiteTheDDDDt:codex/scan-filter-profile
Open

[feature](be) Add OLAP scan filter profile counters#64165
BiteTheDDDDt wants to merge 4 commits into
apache:masterfrom
BiteTheDDDDt:codex/scan-filter-profile

Conversation

@BiteTheDDDDt

@BiteTheDDDDt BiteTheDDDDt commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Existing OLAP scan profiles only expose aggregate filter counters, making it hard to understand the selectivity of each conjunct, runtime filter, key range, and index-related filtering step. This PR adds scan-local filter IDs and materializes detailed ScanFilterInfo and KeyRangeInfo profile sections. Per-filter counters now show input rows, output rows, filtered rows, stage participation, source expression or runtime filter debug text, and runtime filter wait/always-true data where applicable. Runtime filter dynamic partition pruning is exposed as a separate ScanFilterInfo child because it prunes partitions/tablets before segment-level row filtering. Empty mechanism-specific fields are omitted when they do not participate, and runtime filter IDs remain distinct from scan filter IDs.

Release note

Add detailed OLAP scan filter profile counters in query profile.

Check List (For Author)

  • Test: Manual test
    • ./build.sh --be
    • git diff --cached --check
  • Behavior changed: Yes. Query profile includes detailed OLAP ScanFilterInfo and KeyRangeInfo counters.
  • Does this need documentation: No

Copilot AI review requested due to automatic review settings June 6, 2026 03:28
@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?

Copilot AI 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.

Pull request overview

This PR introduces a new BE-side profiling framework to expose detailed, per-filter selectivity for OLAP scans, aiming to make each conjunct/runtime filter/key-range/index/execution-stage filtering step visible in the query profile via ScanFilterInfo and KeyRangeInfo.

Changes:

  • Add ScanFilterProfile/ScanFilterStats infrastructure and materialize per-filter/stage counters into RuntimeProfile.
  • Plumb scan-local filter handles through scan operator normalization, storage predicates, index filtering (zone map/bloom/dict/inverted/ANN), and execution-stage conjunct evaluation.
  • Extend runtime filter consumer profiling to publish RF wait/always-true/debug metadata into the unified scan-filter profile structure.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
design/scan-filter-profile.md Design draft describing the intended per-filter/stage profiling model and semantics.
be/src/runtime/scan_filter_profile.h Declares scan-local filter kinds/stages, stats, handles, and profile materialization API.
be/src/runtime/scan_filter_profile.cpp Implements stats recording, snapshots, sorting, and profile materialization to ScanFilterInfo/KeyRangeInfo.
be/src/exec/operator/scan_operator.h Adds ScanFilterProfile ownership on scan local state and registration helper.
be/src/exec/operator/scan_operator.cpp Creates scan filter profile based on profile_level, attaches handles to conjuncts/pushdowns, and materializes on close.
be/src/exec/operator/olap_scan_operator.h Adds key-range synthetic filter handle storage in OLAP scan local state.
be/src/exec/operator/olap_scan_operator.cpp Registers synthetic key-range filter and tracks source filter lineage for key ranges.
be/src/exec/scan/olap_scanner.cpp Plumbs scan filter profile and key-range handle into tablet reader params.
be/src/storage/tablet/tablet_reader.h Extends reader params to carry scan filter profile + key-range synthetic handle.
be/src/storage/tablet/tablet_reader.cpp Propagates scan filter fields into reader context; attaches handles to function-filter predicates.
be/src/storage/rowset/rowset_reader_context.h Plumbs scan filter profile + key-range handle through rowset reader context.
be/src/storage/rowset/beta_rowset_reader.cpp Propagates scan filter fields into storage read options for segment iterators.
be/src/storage/iterators.h Adds scan filter profile + key-range handle fields to StorageReadOptions.
be/src/storage/predicate/column_predicate.h Adds ScanFilterHandle attachment/storage on column predicates.
be/src/storage/predicate/block_column_predicate.h Exposes scan-filter handle from block predicates; adds scan-filter-aware AND evaluation methods.
be/src/storage/predicate/block_column_predicate.cpp Implements scan-filter-aware evaluation wrappers that record per-predicate stage stats.
be/src/storage/segment/segment_iterator.h Avoids emitting old predicate debug sections when scan-filter profiling is enabled.
be/src/storage/segment/segment_iterator.cpp Records per-filter stats for key range, inverted/ANN, vector/short-circuit predicates, and common expr execution.
be/src/storage/segment/column_reader.h Extends zone-map filtering helper API to accept input row ranges.
be/src/storage/segment/column_reader.cpp Adds per-page input-row counting and per-filter stage recording for zone map/bloom/dict paths.
be/src/exprs/vexpr_context.h Adds scan-filter handle attachment; adds optional stage parameter to conjunct execution/filter helpers.
be/src/exprs/vexpr_context.cpp Records per-conjunct stage input/output rows during conjunct execution when stage is provided.
be/src/exec/scan/scanner.cpp Passes residual stage tag into VExprContext::filter_block() for profiling.
be/src/exec/runtime_filter/runtime_filter_consumer.h Adds API to publish runtime-filter stats into scan-filter profiling.
be/src/exec/runtime_filter/runtime_filter_consumer.cpp Implements publishing RF wait/always-true/debug stats to ScanFilterProfile.
be/src/exec/runtime_filter/runtime_filter_consumer_helper.h Extends realtime profile collection API to optionally target scan-filter profiling.
be/src/exec/runtime_filter/runtime_filter_consumer_helper.cpp Publishes RF acquire time + per-RF stats to ScanFilterProfile when provided.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread be/src/exprs/vexpr_context.cpp
Comment thread be/src/storage/segment/segment_iterator.cpp
Comment thread be/src/storage/segment/column_reader.cpp
Comment thread be/src/exec/operator/olap_scan_operator.cpp
Comment thread be/src/storage/segment/column_reader.cpp Outdated
Comment thread be/src/storage/segment/column_reader.cpp Outdated
@BiteTheDDDDt BiteTheDDDDt force-pushed the codex/scan-filter-profile branch from 5f54636 to 62dd05d Compare June 6, 2026 03:59
@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

/review

@BiteTheDDDDt

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.

I found one blocking observability regression in the new profile path. Existing review comments about scan-filter overhead, pass-through zone-map accounting, missing handles, and incremental inverted-index stats appear addressed in the current head, so I did not repeat them.

Critical checkpoint conclusions:

  • Goal/test: The PR adds per-filter OLAP scan profile counters and mostly wires them through key range, index, vector, short-circuit, common-expr, residual, and runtime-filter paths. The runtime-filter profile fallback is incomplete for filters that do not become scan predicates. The PR currently reports only manual build/check testing; no automated test validates profile materialization or the timeout/disabled runtime-filter case.
  • Scope/clarity: The implementation is focused on profile plumbing and keeps data-path behavior mostly unchanged, but it replaces the old runtime-filter profile output when scan-filter profiling is enabled.
  • Concurrency/lifecycle: New shared profile state uses a mutex for descriptor vectors and relaxed atomics for counters, which is appropriate for statistics. Scanner shutdown happens before final materialization. No new lock-order issue found.
  • Compatibility/config: No storage/protocol/config compatibility issue found. Profile output changes are user-visible.
  • Parallel paths: OLAP scan storage, residual expression, common expr, runtime filter, and key-range paths were reviewed. Non-OLAP scan types still use the base scan profile behavior.
  • Data correctness/transactions: No data visibility, transaction, delete-bitmap, or persistence impact found.
  • Performance: The previously raised no-handle overhead paths are now guarded in current head. Some profile-enabled counting remains expected overhead.
  • Observability: The new profile improves per-filter visibility, but currently drops per-runtime-filter details for runtime filters that never materialize as scan filter expressions.

User focus: No additional user-provided review focus was supplied.

Comment thread be/src/exec/runtime_filter/runtime_filter_consumer_helper.cpp
@BiteTheDDDDt BiteTheDDDDt force-pushed the codex/scan-filter-profile branch from 62dd05d to a4737f3 Compare June 6, 2026 04:58
@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

/review

@BiteTheDDDDt

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.

I found one correctness issue in the new scan-filter profiling path.

Critical checkpoint conclusions:

  • Goal/test: the PR adds unified scan-filter profiling for pushed-down, index, key-range, runtime-filter, and residual scan predicates. The implementation covers the main paths, but the late-arrival runtime-filter path can miss newly appended filters when cost-based conjunct ordering is enabled. No test coverage was found for late-arriving RFs with conjunct reordering and profile-level scan-filter output.
  • Scope/minimality: the change is mostly focused on profiling, but it touches hot scan/storage paths; previously raised overhead issues are already covered by existing threads.
  • Concurrency/lifecycle: scan-filter stats use relaxed atomics for statistics, which is appropriate. Late RF append is protected by _conjuncts_lock, but the registration logic uses unstable vector indexes after sorting.
  • Config/compatibility: no new config or storage/protocol compatibility issue found.
  • Parallel paths: OLAP residual/index/key-range paths are covered, but the late-arrival RF path is a distinct missed path.
  • Tests: no additional user focus was provided; for that focus, no extra issue applies. The missing late-arrival/reorder profile test is the main coverage gap.
  • Observability: the issue is an observability regression in the new profile itself, because the RF can execute as a residual predicate while being shown as not applied/no per-stage stats.
  • Data correctness/transactions/memory: no data visibility, transaction, MoW delete-bitmap, or memory-safety blocking issue found in the reviewed changes.

Please fix the late-arrival handle assignment so newly appended RF contexts are registered before any full-vector reorder, or track the appended contexts directly instead of relying on [conjuncts_before, size) after sorting.

Comment thread be/src/exec/operator/scan_operator.cpp
@BiteTheDDDDt BiteTheDDDDt force-pushed the codex/scan-filter-profile branch from a4737f3 to dd78f25 Compare June 6, 2026 05:41
@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

/review

@BiteTheDDDDt

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.

I found one remaining blocking issue in the current PR diff: native file-scan predicates that are applied inside Parquet/ORC readers are not integrated with the new scan-filter profiling stages, so their real filtering is invisible and later residual counters are misleading.

Critical checkpoint conclusions:

  • Goal/test coverage: the scan-filter profiling goal is only partially achieved; OLAP paths are covered more deeply, but native file-reader pushed-down predicate paths are not proven and currently report incorrect stage rows.
  • Scope/minimality: the scan-filter changes are focused, but one parallel scan path was missed.
  • Concurrency/lifecycle: no new blocking concurrency or lifecycle issue found beyond already-known review threads.
  • Configuration/compatibility: no new config or storage/protocol compatibility concern found.
  • Parallel paths: native file readers (Parquet/ORC) are a parallel predicate-evaluation path and need the same scan-filter accounting.
  • Data correctness: no query-result correctness issue found in the remaining PR diff.
  • Observability/performance: observability is materially wrong for file scans with reader-local pushed-down predicates. Existing review threads already cover the other scan-filter overhead/counter issues, so I did not duplicate them.

User focus: no additional user-provided review focus was specified.

Comment thread be/src/exec/scan/scanner.cpp
@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 7.05% (65/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.70% (21067/39231)
Line Coverage 37.42% (200254/535222)
Region Coverage 33.44% (156940/469298)
Branch Coverage 34.46% (68711/199369)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 7.05% (65/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.70% (21067/39231)
Line Coverage 37.41% (200236/535222)
Region Coverage 33.46% (157034/469298)
Branch Coverage 34.47% (68717/199369)

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29683 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit dd78f25d5e779b96137fa21dc202ac9feee81fd5, 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	17712	4040	4024	4024
q2	q3	10800	1501	862	862
q4	4685	512	362	362
q5	7651	909	593	593
q6	190	170	136	136
q7	788	837	643	643
q8	9433	1630	1716	1630
q9	5878	4591	4583	4583
q10	6752	1820	1528	1528
q11	437	268	251	251
q12	646	429	297	297
q13	18146	3561	2785	2785
q14	262	262	245	245
q15	q16	826	770	703	703
q17	969	907	882	882
q18	7179	5795	5705	5705
q19	1299	1277	1074	1074
q20	537	415	283	283
q21	6587	2987	2779	2779
q22	469	375	318	318
Total cold run time: 101246 ms
Total hot run time: 29683 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	5100	4890	4818	4818
q2	q3	4925	5212	4767	4767
q4	2142	2249	1388	1388
q5	4870	4893	4808	4808
q6	222	178	128	128
q7	1872	1870	1528	1528
q8	2425	2133	2100	2100
q9	8006	7907	7512	7512
q10	4763	4698	4244	4244
q11	540	387	355	355
q12	738	741	529	529
q13	3073	3438	2818	2818
q14	275	281	249	249
q15	q16	682	704	617	617
q17	1312	1267	1257	1257
q18	7295	7003	6959	6959
q19	1131	1106	1135	1106
q20	2245	2228	1944	1944
q21	5334	4607	4446	4446
q22	532	448	408	408
Total cold run time: 57482 ms
Total hot run time: 51981 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 170320 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 dd78f25d5e779b96137fa21dc202ac9feee81fd5, data reload: false

query5	4322	626	485	485
query6	451	211	181	181
query7	4817	555	301	301
query8	384	230	218	218
query9	8791	4023	4057	4023
query10	448	321	258	258
query11	5959	2317	2217	2217
query12	155	108	102	102
query13	1276	617	428	428
query14	6427	5323	5034	5034
query14_1	4377	4381	4372	4372
query15	209	192	172	172
query16	990	456	446	446
query17	940	689	566	566
query18	2440	480	338	338
query19	195	187	150	150
query20	114	107	108	107
query21	210	139	120	120
query22	13593	13506	13347	13347
query23	17413	16591	16238	16238
query23_1	16672	16679	16632	16632
query24	7536	1796	1321	1321
query24_1	1340	1333	1324	1324
query25	581	476	406	406
query26	1320	315	169	169
query27	2681	538	343	343
query28	4555	2071	2054	2054
query29	1109	648	508	508
query30	315	229	205	205
query31	1146	1111	946	946
query32	123	68	72	68
query33	552	330	265	265
query34	1220	1140	659	659
query35	756	802	690	690
query36	1393	1403	1212	1212
query37	159	110	95	95
query38	3209	3150	3066	3066
query39	949	938	895	895
query39_1	890	906	886	886
query40	227	126	105	105
query41	73	82	78	78
query42	98	98	98	98
query43	319	330	283	283
query44	
query45	203	191	186	186
query46	1137	1238	785	785
query47	2399	2380	2277	2277
query48	397	415	289	289
query49	647	488	363	363
query50	998	360	263	263
query51	4486	4299	4268	4268
query52	93	94	82	82
query53	243	273	201	201
query54	288	235	227	227
query55	83	78	72	72
query56	244	255	228	228
query57	1416	1425	1350	1350
query58	264	222	226	222
query59	1602	1679	1465	1465
query60	303	265	249	249
query61	205	158	153	153
query62	719	650	587	587
query63	233	200	187	187
query64	2562	784	608	608
query65	
query66	1795	462	341	341
query67	29865	29642	29517	29517
query68	
query69	420	301	272	272
query70	992	964	957	957
query71	309	226	215	215
query72	3008	2714	2617	2617
query73	872	810	462	462
query74	5114	4961	4725	4725
query75	2661	2601	2248	2248
query76	2331	1189	772	772
query77	354	383	277	277
query78	12408	12580	11999	11999
query79	1514	1040	780	780
query80	1171	500	380	380
query81	510	292	256	256
query82	561	159	123	123
query83	354	278	250	250
query84	304	141	112	112
query85	929	547	460	460
query86	413	287	292	287
query87	3385	3339	3183	3183
query88	3708	2802	2823	2802
query89	431	384	328	328
query90	1860	174	178	174
query91	179	163	138	138
query92	64	61	59	59
query93	1525	1502	943	943
query94	624	351	318	318
query95	664	380	360	360
query96	1064	798	351	351
query97	2709	2723	2588	2588
query98	218	207	212	207
query99	1160	1185	1057	1057
Total cold run time: 253186 ms
Total hot run time: 170320 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 87.96% (811/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.75% (28266/38327)
Line Coverage 57.79% (307568/532177)
Region Coverage 54.66% (257703/471503)
Branch Coverage 56.05% (111913/199652)

@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 87.96% (811/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.52% (28189/38344)
Line Coverage 57.35% (305265/532280)
Region Coverage 54.14% (255317/471598)
Branch Coverage 55.51% (110851/199704)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 87.96% (811/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.70% (28260/38346)
Line Coverage 57.75% (307484/532470)
Region Coverage 54.60% (257549/471741)
Branch Coverage 55.94% (111748/199772)

1 similar comment
@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 87.96% (811/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.70% (28260/38346)
Line Coverage 57.75% (307484/532470)
Region Coverage 54.60% (257549/471741)
Branch Coverage 55.94% (111748/199772)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 87.96% (811/922) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.70% (28262/38346)
Line Coverage 57.77% (307609/532470)
Region Coverage 54.62% (257650/471741)
Branch Coverage 55.97% (111818/199772)

@BiteTheDDDDt BiteTheDDDDt force-pushed the codex/scan-filter-profile branch from dd78f25 to 8a28049 Compare June 8, 2026 06:25
@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

run buildall

@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

/review

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

Automated review summary for PR 64165 at 84a6b78.

I completed a full pass over the changed BE scan/runtime-filter/storage profiling paths and the existing inline review context. I did not find additional distinct inline issues to raise beyond the already-known review threads.

Critical checkpoint conclusions:

  • Goal/test: The PR adds unified ScanFilterInfo/KeyRangeInfo profiling for OLAP scan filters, runtime filters, key ranges, and storage/execution stages. The implementation mostly wires the feature through scan local state, scanner cloning, tablet reader params, rowset readers, segment iterators, and materialization. I did not see new tests in the changed files; validation appears to rely on build/style from prior replies, so profile-output regression coverage remains a risk.
  • Scope/focus: The changes are focused on profiling/observability and avoid storage-format or protocol compatibility changes.
  • Concurrency: New shared scan-filter counters are atomics, and descriptor/runtime-filter stats vectors are protected by ScanFilterProfile::_lock. Scanner threads hold cloned handles to shared stats; materialization happens after scanner stop in close(), so the relaxed atomics are acceptable for statistics.
  • Lifecycle/static initialization: No new cross-translation-unit static initialization dependency was identified. Handles own shared ScanFilterStats only; I did not see a profile ownership cycle.
  • Configuration: No new config item is added.
  • Compatibility: No persisted format, thrift, or mixed-version protocol change was identified.
  • Parallel code paths: OLAP scan paths are wired. File-scan residual attribution is already covered by the existing unresolved inline thread at be/src/exec/scan/scanner.cpp:201 and should be resolved there rather than duplicated here.
  • Conditional checks: Previously raised guard/handle concerns for zone-map/bloom/vector residual hot paths and key-range source ids appear addressed in the current head.
  • Test coverage: No additional test coverage was observed in this PR diff. Given this is profile/observability behavior, an end-to-end profile regression test would reduce risk.
  • Observability: This is an observability feature. The new unified profile preserves unmatched runtime-filter stats in current head, and partition pruning stats are materialized. The known remaining observability risk is the existing file-scan native-reader predicate attribution thread.
  • Transactions/persistence/data writes: Not applicable; this PR does not modify transaction, persistence, or write paths.
  • FE/BE variable passing: Not applicable; the changes are BE-local profiling state, not FE-BE transmitted variables.
  • Performance: The earlier hot-path overhead concerns for scan-filter-disabled zone-map/bloom/conjunct evaluation are guarded in the current head. No further obvious hot-path regression was identified.

User focus: No additional user-provided review focus was specified.

Overall opinion: I found no new distinct issues to submit as inline comments. I would not consider the PR fully ready until the existing unresolved file-scan residual accounting review thread is addressed or explicitly accepted, and I recommend adding profile regression coverage for the new ScanFilterInfo output.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28764 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 84a6b78dab73099aeaabb351276fe74290876bb4, 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	17763	4050	3952	3952
q2	q3	10760	1421	821	821
q4	4686	484	347	347
q5	7567	875	591	591
q6	181	171	137	137
q7	804	845	646	646
q8	9345	1554	1615	1554
q9	5885	4510	4528	4510
q10	6781	1827	1522	1522
q11	432	273	261	261
q12	637	434	287	287
q13	18242	3466	2829	2829
q14	270	263	246	246
q15	q16	822	779	716	716
q17	987	921	892	892
q18	6999	5663	5566	5566
q19	2008	1280	1015	1015
q20	529	425	274	274
q21	6035	2630	2296	2296
q22	430	359	302	302
Total cold run time: 101163 ms
Total hot run time: 28764 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	4406	4258	4412	4258
q2	q3	4504	4939	4358	4358
q4	2099	2179	1383	1383
q5	4471	4291	4294	4291
q6	236	171	128	128
q7	1718	1624	1937	1624
q8	2690	2183	2155	2155
q9	8242	8293	8017	8017
q10	4848	4806	4303	4303
q11	575	409	385	385
q12	761	786	530	530
q13	3401	3553	3030	3030
q14	305	294	281	281
q15	q16	720	745	639	639
q17	1343	1318	1320	1318
q18	8364	7488	7187	7187
q19	1162	1202	1113	1113
q20	2213	2226	1952	1952
q21	5234	4545	4833	4545
q22	521	443	395	395
Total cold run time: 57813 ms
Total hot run time: 51892 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29166 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 84a6b78dab73099aeaabb351276fe74290876bb4, 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	17663	4085	4083	4083
q2	q3	10801	1503	794	794
q4	4683	479	367	367
q5	7608	884	579	579
q6	180	182	141	141
q7	793	846	647	647
q8	9334	1691	1627	1627
q9	5716	4532	4469	4469
q10	6755	1813	1510	1510
q11	440	276	249	249
q12	637	426	299	299
q13	18123	3353	2802	2802
q14	269	258	243	243
q15	q16	841	786	710	710
q17	943	873	1006	873
q18	7000	5835	5626	5626
q19	1294	1150	1116	1116
q20	521	412	261	261
q21	5979	2565	2468	2468
q22	444	353	302	302
Total cold run time: 100024 ms
Total hot run time: 29166 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	4343	4256	4239	4239
q2	q3	4515	4946	4324	4324
q4	2093	2191	1414	1414
q5	4461	4301	4290	4290
q6	226	177	127	127
q7	1791	1693	1769	1693
q8	2834	2327	2269	2269
q9	8163	8296	7988	7988
q10	4845	4799	4287	4287
q11	578	408	378	378
q12	739	765	553	553
q13	3352	3710	3017	3017
q14	318	301	287	287
q15	q16	712	762	647	647
q17	1372	1325	1325	1325
q18	8082	7436	7312	7312
q19	1192	1151	1106	1106
q20	2218	2224	1931	1931
q21	5275	4588	4467	4467
q22	521	449	402	402
Total cold run time: 57630 ms
Total hot run time: 52056 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 169937 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 84a6b78dab73099aeaabb351276fe74290876bb4, data reload: false

query5	4345	627	463	463
query6	433	203	183	183
query7	4820	585	302	302
query8	361	215	213	213
query9	8764	4035	4046	4035
query10	457	332	263	263
query11	5939	2383	2205	2205
query12	161	104	98	98
query13	1249	602	453	453
query14	6447	5422	5112	5112
query14_1	4457	4436	4441	4436
query15	210	199	175	175
query16	997	465	449	449
query17	1131	706	588	588
query18	2538	484	347	347
query19	214	186	152	152
query20	117	111	108	108
query21	218	142	119	119
query22	13624	13810	13360	13360
query23	17295	16566	16221	16221
query23_1	16366	16323	16376	16323
query24	7595	1789	1314	1314
query24_1	1327	1329	1311	1311
query25	590	462	401	401
query26	1330	308	173	173
query27	2665	603	348	348
query28	4447	2050	2022	2022
query29	1103	627	503	503
query30	312	238	206	206
query31	1135	1086	968	968
query32	114	62	59	59
query33	549	340	264	264
query34	1186	1148	709	709
query35	752	781	684	684
query36	1399	1381	1193	1193
query37	152	104	92	92
query38	3236	3150	3079	3079
query39	923	927	899	899
query39_1	858	880	868	868
query40	218	131	97	97
query41	66	64	62	62
query42	94	92	94	92
query43	318	318	281	281
query44	
query45	200	182	184	182
query46	1089	1226	705	705
query47	2396	2368	2222	2222
query48	402	429	291	291
query49	635	470	357	357
query50	941	359	259	259
query51	4322	4357	4249	4249
query52	88	88	76	76
query53	244	270	184	184
query54	266	220	198	198
query55	79	76	71	71
query56	244	227	222	222
query57	1430	1402	1312	1312
query58	264	222	217	217
query59	1548	1647	1435	1435
query60	281	245	239	239
query61	165	157	171	157
query62	697	648	589	589
query63	228	188	184	184
query64	2549	802	632	632
query65	
query66	1791	452	336	336
query67	29893	29801	29622	29622
query68	
query69	441	312	268	268
query70	972	934	923	923
query71	314	228	214	214
query72	2927	2847	2402	2402
query73	868	768	440	440
query74	5135	4995	4786	4786
query75	2665	2605	2236	2236
query76	2333	1154	812	812
query77	361	374	285	285
query78	12409	12707	11918	11918
query79	1423	1049	786	786
query80	1322	473	404	404
query81	533	284	251	251
query82	612	170	119	119
query83	332	275	258	258
query84	
query85	925	538	436	436
query86	423	301	279	279
query87	3433	3367	3209	3209
query88	3696	2777	2717	2717
query89	427	391	334	334
query90	1950	183	176	176
query91	177	160	134	134
query92	65	62	59	59
query93	1575	1415	892	892
query94	711	357	303	303
query95	696	366	433	366
query96	1140	797	346	346
query97	2719	2705	2579	2579
query98	212	214	204	204
query99	1175	1183	1031	1031
Total cold run time: 252677 ms
Total hot run time: 169937 ms

Comment thread be/src/runtime/scan_filter_profile.h
Comment thread be/src/runtime/scan_filter_profile.h
Comment thread be/src/runtime/scan_filter_profile.h
Comment thread be/src/runtime/scan_filter_profile.h Outdated
Comment thread be/src/runtime/scan_filter_profile.h Outdated
Comment thread be/src/runtime/scan_filter_profile.h
Comment thread be/src/runtime/scan_filter_profile.h Outdated
@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 7.10% (65/915) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.83% (21138/39270)
Line Coverage 37.56% (201257/535775)
Region Coverage 33.62% (157889/469697)
Branch Coverage 34.63% (69115/199593)

### What problem does this PR solve?

Issue Number: N/A

Related PR: apache#64165

Problem Summary: Review feedback on the scan filter profile model pointed out that key range metadata and runtime filter metadata were mixed into the generic scan filter descriptor. This refactors the profile model so key range data is stored separately from ordinary scan filter descriptors, runtime filter profile data is attached to the corresponding filter entry, and stage participation is derived from the internal call count instead of a duplicate atomic flag. The change also documents scan filter kinds and stages, and removes redundant display fields from scan filter descriptors.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - build-support/clang-format.sh
    - git diff --check
    - ./build.sh --be
- Behavior changed: No
- Does this need documentation: No
Comment thread be/src/runtime/scan_filter_profile.cpp Outdated
Comment thread be/src/runtime/scan_filter_profile.cpp Outdated
Comment thread be/src/runtime/scan_filter_profile.cpp Outdated
Comment thread be/src/runtime/scan_filter_profile.cpp Outdated
Comment thread be/src/runtime/scan_filter_profile.cpp Outdated
Comment thread be/src/runtime/scan_filter_profile.cpp Outdated
@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 88.41% (778/880) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.94% (28368/38365)
Line Coverage 57.97% (308809/532729)
Region Coverage 54.77% (258460/471901)
Branch Coverage 56.15% (112224/199876)

Copilot AI added 2 commits June 9, 2026 17:45
### What problem does this PR solve?

Issue Number: N/A

Related PR: apache#64165

Problem Summary: Review feedback pointed out that the scan filter profile materialization code used extra helper functions and a derived sort key to order scan filter profile children. This refactors the profile-only display path so scan filters are emitted in stable filter id order, removes the synthetic sort key, replaces hand-written string joins with fmt::join, and relies on the ScanFilterStage enum order directly for stage display iteration.

### Release note

None

### Check List (For Author)

- Test: Manual test
    - build-support/clang-format.sh be/src/runtime/scan_filter_profile.cpp be/src/runtime/scan_filter_profile.h
    - git diff --check
    - build-support/run-clang-tidy.sh --build-dir be/build_Release
    - ./build.sh --be
- Behavior changed: No
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: N/A

Related PR: apache#64165

Problem Summary: Scan filter profiling had several defensive null and handle guards in paths where the scan local state should already know whether profiling is enabled and should have attached handles to predicates or pushed-down expressions. These guards could silently skip per-filter profile data and hide missing attach bugs. This change keeps profile-enabled checks at call sites, asserts required roots and handles when the profiling path is active, and keeps truly optional storage reader handles guarded.

### Release note

None

### Check List (For Author)

- Test: Manual test: ./build.sh --be; Static Analysis: CLANG_TIDY_BINARY=/mnt/disk6/common/ldb_toolchain_028/bin/clang-tidy build-support/run-clang-tidy.sh --build-dir be/build_Release

- Behavior changed: No

- Does this need documentation: No
@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

run buildall

@BiteTheDDDDt

Copy link
Copy Markdown
Contributor Author

/review

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

Review opinion: no additional blocking issues found in the current PR head beyond the already-known inline review threads.

Critical checkpoint conclusions:

  • Goal/test: the PR adds structured scan-filter profiling for OLAP scan predicates, key ranges, indexes, runtime filters, and residual execution. The implementation follows the intended data flow. I did not run the full BE test suite in this review session.
  • Scope/focus: the changes are broad but mostly focused on scan-filter observability plumbing. Existing review threads already cover several simplification and design concerns.
  • Concurrency: shared scan-filter counters use atomics and profile registration/materialization is mutex-protected. Late runtime-filter handle attachment is done under the existing conjunct lock before sorting, so I did not find a new concurrency issue.
  • Lifecycle: scan-filter handles hold shared stats objects and are copied into cloned scanner contexts/predicates; I did not find a use-after-free or circular ownership problem.
  • Configuration: no new config items were added.
  • Compatibility/storage format: no storage format or FE-BE protocol compatibility issue found.
  • Parallel paths: OLAP scan storage paths are covered; file-scan residual attribution has already been raised in an existing thread, so I did not duplicate it.
  • Conditional checks: the remaining questionable invariants and structure concerns around scan-filter desc/key-range handling are already covered by existing review threads.
  • Test coverage: I did not find added tests in the inspected diff; this is a residual coverage risk for profile correctness, especially because many counters are profile-only observability behavior.
  • Observability: this PR is observability-focused and preserves unmatched runtime-filter profile data in the current head. No additional observability regression found beyond existing threads.
  • Transactions/persistence/data writes: not applicable.
  • FE-BE variables: not applicable for the inspected current PR file set.
  • Performance: previously reported hot-path overhead issues appear addressed in current code where I checked, and I did not find a distinct new hot-path regression.

User focus: no additional user-provided review focus was specified.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29563 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 62b34e812ef93eee64edaa966e47295496023406, 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	17776	4065	4023	4023
q2	q3	10744	1450	860	860
q4	4701	483	353	353
q5	7585	871	594	594
q6	190	176	136	136
q7	781	864	634	634
q8	9847	1695	1642	1642
q9	7311	4548	4559	4548
q10	6814	1801	1558	1558
q11	444	270	254	254
q12	638	436	299	299
q13	18262	3484	2812	2812
q14	269	259	244	244
q15	q16	837	777	715	715
q17	926	948	937	937
q18	7146	5764	5619	5619
q19	1191	1277	1068	1068
q20	525	394	270	270
q21	6334	2799	2675	2675
q22	468	386	322	322
Total cold run time: 102789 ms
Total hot run time: 29563 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	4860	4678	5007	4678
q2	q3	4947	5232	4674	4674
q4	2165	2179	1400	1400
q5	4942	4722	4776	4722
q6	252	186	133	133
q7	1872	1772	1611	1611
q8	2373	1956	1965	1956
q9	7429	7448	7415	7415
q10	4782	4732	4286	4286
q11	544	385	353	353
q12	716	735	532	532
q13	3088	3407	2785	2785
q14	284	280	250	250
q15	q16	685	704	647	647
q17	1300	1292	1273	1273
q18	7568	6886	6771	6771
q19	1174	1160	1149	1149
q20	2242	2238	1947	1947
q21	5311	4618	4452	4452
q22	522	462	433	433
Total cold run time: 57056 ms
Total hot run time: 51467 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 171376 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 62b34e812ef93eee64edaa966e47295496023406, data reload: false

query5	4299	635	492	492
query6	432	204	184	184
query7	4833	560	304	304
query8	370	220	209	209
query9	8789	4078	4021	4021
query10	477	314	265	265
query11	5727	2381	2186	2186
query12	155	102	98	98
query13	1278	597	422	422
query14	6502	5434	5087	5087
query14_1	4444	4426	4419	4419
query15	205	201	175	175
query16	1010	460	436	436
query17	1103	699	574	574
query18	2700	475	337	337
query19	205	183	145	145
query20	115	108	102	102
query21	219	144	121	121
query22	13626	13544	13386	13386
query23	17335	16528	16475	16475
query23_1	16746	16571	16325	16325
query24	7418	1763	1338	1338
query24_1	1302	1323	1328	1323
query25	561	454	385	385
query26	1301	328	163	163
query27	2631	533	333	333
query28	4434	2008	1998	1998
query29	1083	614	482	482
query30	317	234	202	202
query31	1134	1081	941	941
query32	145	63	57	57
query33	528	325	269	269
query34	1197	1164	644	644
query35	749	774	692	692
query36	1372	1405	1236	1236
query37	155	107	90	90
query38	3234	3169	3034	3034
query39	940	935	894	894
query39_1	879	883	881	881
query40	213	119	100	100
query41	66	65	62	62
query42	96	97	92	92
query43	318	323	285	285
query44	
query45	197	182	184	182
query46	1140	1220	736	736
query47	2430	2387	2278	2278
query48	404	434	294	294
query49	625	468	352	352
query50	991	354	257	257
query51	4422	4273	4243	4243
query52	88	88	77	77
query53	252	269	203	203
query54	282	215	213	213
query55	88	87	69	69
query56	246	226	238	226
query57	1447	1430	1344	1344
query58	247	225	216	216
query59	1562	1671	1464	1464
query60	293	253	243	243
query61	163	159	165	159
query62	714	657	578	578
query63	234	191	183	183
query64	2548	798	645	645
query65	
query66	1756	470	344	344
query67	30193	29718	29583	29583
query68	
query69	426	305	264	264
query70	990	976	956	956
query71	306	217	213	213
query72	3050	2784	2524	2524
query73	891	763	447	447
query74	5134	4972	4774	4774
query75	2703	2630	2263	2263
query76	2341	1171	792	792
query77	372	394	304	304
query78	12333	12315	11868	11868
query79	1328	1070	772	772
query80	631	491	426	426
query81	476	285	260	260
query82	584	159	128	128
query83	377	291	257	257
query84	
query85	975	607	536	536
query86	375	306	299	299
query87	3479	3339	3211	3211
query88	3707	2785	2774	2774
query89	427	394	345	345
query90	1868	190	181	181
query91	237	161	144	144
query92	62	63	57	57
query93	1483	1446	887	887
query94	540	360	308	308
query95	688	480	348	348
query96	1106	788	352	352
query97	2708	2695	2569	2569
query98	227	208	203	203
query99	1181	1200	1017	1017
Total cold run time: 252421 ms
Total hot run time: 171376 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 89.80% (713/794) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.94% (28374/38373)
Line Coverage 57.98% (309009/532995)
Region Coverage 54.72% (258361/472186)
Branch Coverage 56.17% (112314/199960)

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.

4 participants