Skip to content

[improvement](be) Speed up dense unscored inverted index conjunctions - #69172

Merged
airborne12 merged 3 commits into
apache:masterfrom
airborne12:m2-skip-all-rows-terms
Oct 17, 2026
Merged

airborne12 merged 3 commits into
apache:masterfrom
airborne12:m2-skip-all-rows-terms

Conversation

@airborne12

@airborne12 airborne12 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: N/A

Related PR: #68758

Problem Summary:

#68758 runs an unscored AND of terms on one field, such as MATCH_ALL, as a chain: the rarest term's rows are listed into an array and the other terms narrow them into another. On dense terms this was slower than the bitmap intersection it replaced on V2 segments, and its arrays grew with the segment (review comment M2 on #68758):

  1. A term held by every row cannot remove any row, but the chain still read its postings. For MATCH_ALL 'http status', where both terms are held by every row, it copied every row id twice and rebuilt the result bitmap from the array: 14.4 ms on a 2M-row V2 segment, about 10 times what it took before [refactor](be) Unify MATCH and SEARCH execution across inverted index formats #68758.
  2. A term left alone, such as get in get http once http is skipped, was listed into an array of all its rows before the result bitmap was built from it. For a term in 90% of 2M rows that cost about 1,200 extra page faults per query.
  3. Intersecting a block through a bit set tested each candidate with a branch. For two unrelated terms each in half the rows (alpha beta), the branch mispredicted about half the time, and the intersection took 30% of the scan thread's cycles.
  4. The arrays held up to 8 bytes per row of the segment in each scanner.

This PR:

  • skips a term whose document frequency equals the source's document count, so a conjunction whose terms are all held by every row returns every row, or every candidate, without reading postings;
  • lists a lone term's blocks straight into the result bitmap, a dense block as a range;
  • intersects a block through its bit set without a branch per candidate: every candidate is written and kept only when its bit is set;
  • streams a conjunction of several terms on a source that reads on demand, such as a V2 segment: the cheapest term lists at most 2^16 of its rows at a time, the others narrow them, and the rows left go straight into the result, so no array holds more than a batch. The other terms keep their current block from one batch to the next, so each block is still decoded once. A batching source, such as SNII, keeps the chain, which reads each term's blocks in one round.

Scored queries keep their path, and results are unchanged.

Index filter time of MATCH_ALL on a 2M-row V2 segment, as the median ratio of 8 paired runs on fresh backends; each column is a separate comparison and lower is faster:

Query Rows holding each term vs #68758 vs before #68758
http status 100%, 100% 0.01 0.10
rare http 0.05%, 100% 0.31 0.10
sparse http 0.5%, 100% 0.23 0.31
get http 90%, 100% 0.60 0.95
alpha beta 50%, 50% 0.56 0.72

In the comparison with #68758, the http status filter drops from 16.9 ms to 0.15 ms and its end-to-end time to 0.63, and the end-to-end time of alpha beta to 0.81. SNII segments take the same paths except the stream; there these queries take 0.02 to 0.83 of #68758 and 0.02 to 0.93 of their time before #68758. Seven more shapes, from rare alpha and sparse alpha to alpha beta get and the empty get post, take 0.20 to 0.89 of their time before #68758 on V2 and 0.57 to 1.00 on SNII. Two-term MATCH_ALL queries on short text take 0.86 to 1.01 of #68758, and the 18 queries used to accept #68758 (MATCH_PHRASE, MATCH_ANY and SEARCH phrases on V2 and SNII) stay between 0.97 and 1.03 of it, every 95% interval including 1.

On V2 the stream holds at most two arrays of 2^16 rows per scanner, and it cuts the page faults per query of alpha beta from 458 to 192 and those of get alpha from 484 to 47. Its scan threads run within 1% of the chain's instructions, and a cheapest term of at most 2^16 rows is listed in one batch, as the chain lists it.

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

    Unit test: ListedTermsTest.AConjunctionSkipsATermHeldByEveryRow and ListedTermsTest.AConjunctionOfTermsHeldByEveryRowHoldsEveryRow fail before the first commit, because the chain read the term held by every row, and pass after it. ListedTermsTest.AConjunctionOnAStreamingSourceStreamsItsTerms replaces AConjunctionOnAStreamingSourceChainsItsTermsToo, which recorded that such a source chained its terms, and fails before the last commit. ListedTermsTest.ALoneTermListsItsRowsOrThoseAmongTheCandidates, CursorChainedPostings.IntersectionHandlesRandomDensities and the CursorChainedPostings.AStream* tests cover the lone-term listing, the intersection and the stream; each fails when the code it covers is broken on purpose.

    Manual test: a 2M-row corpus with terms held by 100%, 90%, 50%, 10%, 0.5% and 0.05% of the rows was loaded into a V2 table and an SNII table. Each of 8 pairs started two fresh backends, one per build, swapping which backend ran which build on alternate pairs; each query ran 4 warm-up and 16 measured times on each build, alternating between the builds. Every result matched aggregates computed independently from the corpus. Scan-thread CPU time, cycles, instructions and page faults were sampled with perf stat over 200 runs of each query on each build.

  • 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

…d index conjunction

### What problem does this PR solve?

Issue Number: None

Related PR: apache#68758

Problem Summary: An unscored AND of terms on one field, such as MATCH_ALL, lists
the rarest term's rows into an array and narrows it by the other terms. A term
held by every row cannot remove any row, but the chain still reads its postings.
For `MATCH_ALL 'http status'`, where both terms are held by every row, it copies
every row id twice and rebuilds the result bitmap from the array. On a 2M-row V2
segment the index filter took 14.4 ms, about 10 times what it took before apache#68758.

A term whose document frequency equals the source's document count is held by
every row the source lists, so it cannot narrow the conjunction. The chain now
skips such terms, and a conjunction whose terms are all held by every row returns
every row, or every candidate, without reading postings. Scored queries and
conjunctions without such a term run as before.

Index filter time of MATCH_ALL on a 2M-row V2 segment, as the median ratio of
8 paired runs on fresh backends; each column is a separate comparison and lower
is faster:

| Query         | Rows holding each term | vs apache#68758                | vs before apache#68758         |
|---------------|------------------------|--------------------------|--------------------------|
| `http status` | 100%, 100%             | 0.01 (14.43 -> 0.15 ms)  | 0.11 (1.53 -> 0.16 ms)   |
| `rare http`   | 0.05%, 100%            | 0.34 (0.62 -> 0.21 ms)   | 0.11 (2.24 -> 0.25 ms)   |
| `sparse http` | 0.5%, 100%             | 0.24 (1.18 -> 0.29 ms)   | 0.31 (1.04 -> 0.34 ms)   |
| `get http`    | 90%, 100%              | 0.88 (14.15 -> 12.20 ms) | 1.22 (10.25 -> 12.83 ms) |
| `alpha beta`  | 50%, 50%               | 1.02                     | 1.36                     |

The end-to-end time of `MATCH_ALL 'http status'` falls to 0.64 of apache#68758, in
line with that before apache#68758 (0.96). On SNII segments, which take the same
path, the `http status` filter drops from 13.67 ms to 0.37 ms, and no dense
query is slower. Two-term MATCH_ALL queries on short text and the 18 queries used to
accept apache#68758 (MATCH_PHRASE, MATCH_ANY and SEARCH phrases on V2 and SNII) stay
between 0.97 and 1.03 of apache#68758, and every 95% interval includes 1. Dense
conjunctions without a term held by every row, such as `alpha beta`, are not
changed by this PR.

### Release note

None

### Check List (For Author)

- Test: Unit Test. ListedTermsTest.AConjunctionSkipsATermHeldByEveryRow and
  ListedTermsTest.AConjunctionOfTermsHeldByEveryRowHoldsEveryRow fail before the
  change, because the chain read the term held by every row, and pass after it.
  Manual test: the benchmark above; every result matched aggregates computed
  independently from the corpus.
- Behavior changed: No. Results are unchanged; only fewer postings are read.
- Does this need documentation: No
@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?

@airborne12

Copy link
Copy Markdown
Member Author

run buildall

@airborne12

Copy link
Copy Markdown
Member 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.

Reviewed all four changed files at 7cf31319d52edfd67b781f4610680e5fe17f8809. No new actionable findings and no existing inline P0/P1 findings to carry forward. The review converged in round 1: both complete reviewers and the separate risk reviewer returned NO_NEW_VALUABLE_FINDINGS; every candidate and initial risk was independently verified and dismissed with evidence.

The production path inspected was MATCH_ALL/SEARCH unscored AND → same-source ListedTerms → cursor open → universal-term pruning or remaining cursor chain → TruthSet intersection → result bitmap. CLucene uses maxDoc and one document per Doris row, including empty documents for NULLs; SNII uses total document count and validates unique bounded posting IDs. Doris deletion filtering remains outside these posting lists, and final scan consumers intersect results, so synthesizing the full source domain does not restore excluded scan rows. Candidate IDs are sorted and bounded by the caller/source contract.

Critical checkpoint conclusions:

  1. Goal and tests: the change removes redundant universal operands from unscored AND. The two added unit tests assert the expected partial/all-universal rows and absence of universal-term prefetch, including a supplied candidate subset. These assertions were inspected, not executed.
  2. Scope and clarity: the four-file change is focused; both cursor overloads reuse one implementation.
  3. Concurrency and locking: query-local synchronous execution; no new shared mutation, threads, locks, or lock order.
  4. Lifecycle and initialization: owning cursors outlive the raw-pointer views; reserved wrapper storage keeps addresses stable; SNII destructors cancel pending callbacks. No new static initialization or ownership cycle.
  5. Configuration: no configuration or dynamic propagation change.
  6. Compatibility and rolling upgrades: the owning overload remains; no storage-format, RPC, or external ABI removal. No new libc dependency is apparent from the changed code; no release ELF was built or audited.
  7. Thrift/protobuf: no generated-definition change or cross-branch ID obligation.
  8. Parallel paths: both CLucene and SNII reach the shared unscored AND path. Scored AND retains universal terms' score contributions; disjunction, phrase, gram, and nested NOT behavior retain their required paths.
  9. Special conditions: the skip invariant is documented; absent terms return before pruning. Sorted candidate clipping, zero-row sources, empty candidates, duplicate terms, scalar/array NULLs, and parent TRUE/UNKNOWN intersections were traced without finding a new result difference.
  10. Coverage: new tests exercise partial pruning for both source batch settings and all-universal full/subset results. Existing NULL, absent, scored, candidate, and multi-wave tests were inspected. The new tests use fakes rather than real-format I/O; production universality was checked separately through writer/reader/factory/compaction control flow.
  11. Test results: expected fake intersections and the every-row helper are correct by inspection. No golden/result files changed; author-reported executions and performance numbers were not independently reproduced.
  12. Observability: existing search initialization/execution and filter timers enclose the optimization; no new operational state needs separate logging or metrics.
  13. Transactions and persistence: no EditLog, commit/failover, visible-version selection, or persistent metadata mutation changes.
  14. Writes and atomicity: no data-write protocol or write-side lifecycle changes. Delete-bitmap subtraction and monotonic scan-result intersection remain intact.
  15. FE/BE variables: none added; no transport send path needs updating.
  16. Performance, memory, and errors: all-universal conjunctions avoid document-array materialization; partial conjunctions trade O(term count) observer-vector work for skipped posting enumeration. Ownership and Status propagation remain sound. SNII can still fetch preludes already queued with other cursors, which limits I/O savings without changing correctness. The pure-text build-hygiene gate passed.
  17. Other invariants and focus: no additional rowset/segment-identity, visibility, NULL algebra, or silent-error regression was substantiated. No additional user-provided review focus was supplied.

Validation limits: static source review and a pure-text hygiene check only. No build, unit/regression test, sanitizer, runtime ABI audit, or benchmark was run. Third-party CLucene internals were not available in this checkout; its production construction and compaction boundaries were reviewed. No unresolved behavioral candidate or uncovered changed-file scope remains.

Review converged after 1 round(s).

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17614	5713	5568	5568
q2	2160	318	264	264
q3	10170	1497	853	853
q4	4691	472	346	346
q5	7437	825	544	544
q6	193	185	159	159
q7	793	805	596	596
q8	9248	1353	1141	1141
q9	5574	4284	4309	4284
q10	6838	1309	1026	1026
q11	421	255	243	243
q12	642	416	299	299
q13	18064	3656	3037	3037
q14	283	272	251	251
q15	q16	751	734	674	674
q17	1219	752	572	572
q18	7141	6228	6200	6200
q19	1266	968	613	613
q20	400	342	228	228
q21	6322	2563	2682	2563
q22	425	379	312	312
Total cold run time: 101652 ms
Total hot run time: 29773 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6796	6711	6769	6711
q2	793	617	568	568
q3	5610	5746	5337	5337
q4	2116	2178	1671	1671
q5	5754	5526	5776	5526
q6	261	193	150	150
q7	2266	2065	1857	1857
q8	3238	2777	2791	2777
q9	8168	8036	7968	7968
q10	3655	3638	3247	3247
q11	614	439	410	410
q12	677	694	517	517
q13	3314	3664	3002	3002
q14	291	285	265	265
q15	q16	685	689	612	612
q17	7878	7229	6947	6947
q18	13113	12286	13179	12286
q19	979	866	841	841
q20	2205	2180	1937	1937
q21	6045	5020	5077	5020
q22	519	470	425	425
Total cold run time: 74977 ms
Total hot run time: 68074 ms

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17575	5663	5594	5594
q2	2148	326	266	266
q3	10194	1412	847	847
q4	4680	473	349	349
q5	7432	793	532	532
q6	186	185	153	153
q7	776	809	609	609
q8	9267	1364	1137	1137
q9	5568	4316	4286	4286
q10	6816	1301	1032	1032
q11	441	257	242	242
q12	631	398	286	286
q13	18134	4282	3032	3032
q14	277	273	245	245
q15	q16	736	728	664	664
q17	1207	758	577	577
q18	7100	6251	6201	6201
q19	1242	986	599	599
q20	387	351	223	223
q21	5145	2505	2644	2505
q22	427	381	296	296
Total cold run time: 100369 ms
Total hot run time: 29675 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6654	6626	6743	6626
q2	756	609	571	571
q3	5512	5766	5224	5224
q4	2003	2188	1558	1558
q5	5803	5746	5712	5712
q6	243	190	152	152
q7	2254	2060	1762	1762
q8	3255	2761	2781	2761
q9	8180	8058	7922	7922
q10	3650	3596	3230	3230
q11	602	406	388	388
q12	658	689	488	488
q13	3332	3661	3009	3009
q14	287	294	271	271
q15	q16	676	688	607	607
q17	7749	6931	6852	6852
q18	13149	12236	13167	12236
q19	916	793	792	792
q20	2196	2171	1950	1950
q21	5837	4728	4812	4728
q22	499	465	404	404
Total cold run time: 74211 ms
Total hot run time: 67243 ms

@hello-stephen

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

query5	4311	582	424	424
query6	444	204	191	191
query7	4830	440	224	224
query8	309	166	148	148
query9	8741	3945	3911	3911
query10	475	312	264	264
query11	6045	3784	3514	3514
query12	147	92	90	90
query13	1300	472	323	323
query14	6135	4005	3750	3750
query14_1	3549	3491	3480	3480
query15	207	197	182	182
query16	959	444	416	416
query17	849	667	541	541
query18	2453	433	313	313
query19	197	160	131	131
query20	86	89	84	84
query21	211	134	109	109
query22	12944	13083	12879	12879
query23	13522	12828	12525	12525
query23_1	12516	12523	12606	12523
query24	7117	821	469	469
query24_1	470	468	468	468
query25	546	424	362	362
query26	1326	259	137	137
query27	2763	436	269	269
query28	4630	1945	1938	1938
query29	1593	606	450	450
query30	301	225	193	193
query31	1016	925	814	814
query32	169	93	87	87
query33	517	299	243	243
query34	927	854	488	488
query35	748	759	678	678
query36	817	786	724	724
query37	136	98	87	87
query38	1799	1763	1687	1687
query39	800	803	741	741
query39_1	745	730	757	730
query40	212	111	92	92
query41	63	61	60	60
query42	80	80	80	80
query43	368	373	330	330
query44	1272	684	699	684
query45	182	173	159	159
query46	860	957	561	561
query47	2983	2994	2935	2935
query48	302	305	218	218
query49	577	405	280	280
query50	676	271	213	213
query51	10486	10386	10228	10228
query52	75	76	70	70
query53	182	211	155	155
query54	249	194	192	192
query55	72	67	65	65
query56	305	222	200	200
query57	1592	1587	1565	1565
query58	298	261	252	252
query59	2166	2145	1986	1986
query60	277	241	225	225
query61	144	148	142	142
query62	386	339	287	287
query63	194	163	163	163
query64	2757	973	747	747
query65	3292	3227	3243	3227
query66	1777	433	296	296
query67	20080	20075	19763	19763
query68	2965	992	609	609
query69	380	284	248	248
query70	855	792	775	775
query71	288	233	204	204
query72	2783	2603	2246	2246
query73	510	532	294	294
query74	4546	4445	4295	4295
query75	2324	2291	1928	1928
query76	2316	1016	587	587
query77	345	380	287	287
query78	9747	9825	9193	9193
query79	966	908	512	512
query80	528	418	349	349
query81	534	317	270	270
query82	1067	134	115	115
query83	299	194	183	183
query84	313	119	103	103
query85	801	418	369	369
query86	326	251	236	236
query87	2036	1972	1837	1837
query88	3609	2704	2691	2691
query89	330	295	258	258
query90	1912	186	175	175
query91	162	153	129	129
query92	90	88	85	85
query93	1013	997	569	569
query94	434	323	277	277
query95	584	393	320	320
query96	660	528	229	229
query97	2479	2417	2333	2333
query98	160	156	143	143
query99	777	758	644	644
Total cold run time: 234486 ms
Total hot run time: 151553 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.56 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 7cf31319d52edfd67b781f4610680e5fe17f8809, data reload: false

query1	0.01	0.01	0.01
query2	0.11	0.06	0.05
query3	0.27	0.12	0.11
query4	1.60	0.12	0.12
query5	0.25	0.25	0.25
query6	1.18	0.70	0.68
query7	0.04	0.00	0.00
query8	0.05	0.04	0.04
query9	0.41	0.35	0.36
query10	0.59	0.57	0.58
query11	0.20	0.15	0.14
query12	0.19	0.14	0.15
query13	0.49	0.50	0.49
query14	1.01	1.00	1.01
query15	0.63	0.59	0.61
query16	0.36	0.32	0.35
query17	1.14	1.13	1.14
query18	0.24	0.21	0.21
query19	2.09	1.97	2.02
query20	0.02	0.01	0.02
query21	15.52	0.26	0.15
query22	4.37	0.05	0.06
query23	16.32	0.31	0.12
query24	3.32	0.61	0.40
query25	0.12	0.07	0.07
query26	1.04	0.25	0.15
query27	0.06	0.04	0.03
query28	1.60	0.59	0.38
query29	12.48	4.18	3.35
query30	0.28	0.14	0.13
query31	2.78	0.57	0.33
query32	3.23	0.61	0.52
query33	3.12	3.24	3.18
query34	15.40	3.97	3.39
query35	3.36	3.32	3.36
query36	0.55	0.46	0.46
query37	0.10	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.15	0.14
query41	0.09	0.03	0.02
query42	0.04	0.03	0.03
query43	0.05	0.03	0.03
Total cold run time: 94.98 s
Total hot run time: 24.56 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 66.34% (31685/47762)
Line Coverage 51.08% (333541/653015)
Region Coverage 46.45% (269571/580401)
Branch Coverage 48.15% (126890/263538)

…date and list a lone term straight into the result

### What problem does this PR solve?

Issue Number: None

Related PR: apache#68758

Problem Summary: After terms held by every row are skipped, two dense MATCH_ALL cases on
V2 stay slower than before apache#68758. For `get http`, the term left alone is listed into an
array of every row it holds before the result bitmap is built from it, which costs about
1,200 extra page faults per query on 2M rows. For `alpha beta`, two unrelated terms each
held by half the rows, the bit-set intersection tests each candidate with a branch that
mispredicts about half the time; it takes 30% of the scan thread's cycles.

A lone term now lists its blocks straight into the result, a dense block as a range. The
bit-set intersection writes every candidate and keeps it only when its bit is set, so no
branch depends on whether a candidate matches. On a 2M-row V2 segment the index filter of
`get http` drops to 0.74 and that of `alpha beta` to 0.73 of the previous commit, 0.98 and
0.92 of their time before apache#68758; on SNII they drop to 0.79 and 0.70.

### Release note

None

### Check List (For Author)

- Test: Unit Test. ListedTermsTest.ALoneTermListsItsRowsOrThoseAmongTheCandidates and
  CursorChainedPostings.IntersectionHandlesRandomDensities; each fails when the code it
  covers is broken on purpose. Manual test: the dense MATCH_ALL benchmark of the previous
  commit, and the 18 queries used to accept apache#68758, which stay within 0.97 and 1.02 of the
  previous commit.
- Behavior changed: No.
- Does this need documentation: No
@airborne12

Copy link
Copy Markdown
Member Author

run buildall

@airborne12

Copy link
Copy Markdown
Member Author

/review

@airborne12 airborne12 changed the title [improvement](be) Skip terms held by every row in an unscored inverted index conjunction [improvement](be) Speed up dense unscored inverted index conjunctions Oct 16, 2026

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

Reviewed all five changed files at 58005f7 and the relevant callers, providers, writers, compaction and result consumers. No new actionable findings and no existing inline blockers to carry forward. The review converged in round 1: both complete-coverage reviewers and the separate risk reviewer returned NO_NEW_VALUABLE_FINDINGS after their missed-risk rechecks; all candidates and initial risks were independently verified and dismissed.

Critical checkpoint conclusions:

  1. Goal and correctness: the shortcut removes universal terms only from unscored AND. CLucene uses maxDoc; SNII counts all physical rows, including NULL/empty/array rows, and validates unique bounded postings. These support the universal-term predicate and synthetic range. Doris delete-bitmap restrictions remain applied to scan rows. Added unit cases check matching rows and skipped prefetches; they were inspected, not executed.
  2. Scope and reuse: focused changes in three production files and two existing unit-test files. Both chain overloads share one implementation; list_blocks reuses the existing block-to-sink traversal.
  3. Concurrency and locking: no new threads, locks or shared mutable state. Cursor mutation and results stay within synchronous query execution; no new lock ordering issue found.
  4. Lifecycle and static initialization: narrowing pointers borrow live owning cursors; reserved chain storage keeps references stable. No escaping pointers, ownership cycles or new static initialization found.
  5. Configuration: none added or changed; dynamic-update behavior is not applicable.
  6. Compatibility: no wire, storage-format, dependency or rolling-upgrade changes. Existing owning-cursor API remains available alongside the internal pointer overload; no new libc API usage identified.
  7. Thrift/protobuf: untouched.
  8. Parallel paths: V2 and SNII use the common execution path. Scored conjunction retains all term contributions; OR/NOT and phrase positional semantics remain preserved. Shared phrase callers were traced.
  9. Special conditions: comments explain universal-term elimination, sole-term direct listing and branchless writes. Candidate vectors are sorted by their Roaring producer. Bounded block slices and resize(prefix + candidate_count) cover every unconditional store; callers keep input and output buffers separate.
  10. Test coverage: new cases cover mixed/all-universal terms and lone narrowing terms, with and without candidates and both batching modes where applicable. The random test checks both ordinals and document output; existing tests cover bounded/wide blocks, shifted IDs, dense ranges, NULLs, absent terms, mixed clauses and scoring. No new real-format end-to-end cases were added. Explicit empty/out-of-range universal candidates, universal scored/nullable integration, injected helper errors and a multi-block bitset append-prefix case remain test opportunities; source tracing found no unresolved defect in them.
  11. Test results: added expected row sets agree with the fixtures and independent intersection logic. No regression golden files were changed.
  12. Observability: existing index-search/filter timers and error propagation cover this local optimization; no additional operation or failure class requires new instrumentation.
  13. Transactions and persistence: no transaction, version-visibility, EditLog/replay or failover logic changes. Physical-row and compaction-count invariants were traced.
  14. Data writes and crash atomicity: read-only evaluation; no new write or recovery lifecycle.
  15. FE/BE variables: none added; no propagation changes required.
  16. Performance, memory and errors: universal terms avoid postings decoding; the lone-term sink avoids an intermediate row vector. Branchless scratch is bounded by the candidate slice and preserves the existing prefix. New Status calls propagate errors; no new ignored failure found. Benchmark claims were not independently measured.
  17. Other concerns: rechecked absent/zero-row cases, repeated tokens, NULL/empty/array fields, deletion/compaction, dense blocks, ordinal consumers and borrowed-pointer lifetime; no additional substantiated issue found.

No additional user focus was supplied. Limits: static review only; no builds or tests run and no source modifications. CLucene submodule internals are absent locally and were left uninitialized; its Doris wrappers, writer/compaction interfaces and existing tests were inspected. Runtime behavior and author benchmark results remain unverified. No changed file or correctness candidate remains unresolved within the required static scope.

Review converged after 1 round(s).

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17606	5688	5555	5555
q2	2095	340	249	249
q3	10226	1424	857	857
q4	4682	471	344	344
q5	7436	807	536	536
q6	198	191	157	157
q7	776	811	611	611
q8	9258	1380	1196	1196
q9	5534	4280	4281	4280
q10	6832	1299	1019	1019
q11	468	257	242	242
q12	642	406	296	296
q13	18065	3548	3010	3010
q14	272	279	252	252
q15	q16	740	729	655	655
q17	1214	751	594	594
q18	7057	6225	6189	6189
q19	1109	970	637	637
q20	384	352	238	238
q21	4894	2292	2493	2292
q22	363	309	276	276
Total cold run time: 99851 ms
Total hot run time: 29485 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6201	6139	6155	6139
q2	712	581	542	542
q3	5222	5396	4954	4954
q4	2011	2154	1559	1559
q5	5284	5392	5691	5392
q6	253	202	158	158
q7	2304	2050	1870	1870
q8	3229	2834	2781	2781
q9	8087	7966	8125	7966
q10	3833	3748	3397	3397
q11	650	447	446	446
q12	737	745	555	555
q13	3512	3909	3315	3315
q14	316	339	306	306
q15	q16	714	724	674	674
q17	8517	7562	7111	7111
q18	13179	12279	13049	12279
q19	970	855	858	855
q20	2202	2186	1950	1950
q21	5947	4883	4924	4883
q22	529	461	433	433
Total cold run time: 74409 ms
Total hot run time: 67565 ms

@hello-stephen

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

query5	4322	587	467	467
query6	425	206	190	190
query7	4802	428	231	231
query8	333	172	158	158
query9	8785	4056	4030	4030
query10	475	318	285	285
query11	5886	3811	3557	3557
query12	149	89	87	87
query13	1232	435	316	316
query14	6173	4125	3814	3814
query14_1	3576	3593	3628	3593
query15	205	200	178	178
query16	929	458	414	414
query17	888	655	540	540
query18	2420	432	315	315
query19	202	171	133	133
query20	85	87	82	82
query21	212	137	117	117
query22	13082	12936	12753	12753
query23	13511	12815	12401	12401
query23_1	12634	12676	12563	12563
query24	7095	860	469	469
query24_1	472	482	474	474
query25	556	426	355	355
query26	1079	261	136	136
query27	2744	450	276	276
query28	4561	1935	1914	1914
query29	1455	608	453	453
query30	304	219	189	189
query31	1014	928	818	818
query32	143	95	93	93
query33	522	300	253	253
query34	877	860	498	498
query35	764	777	641	641
query36	854	799	740	740
query37	145	108	89	89
query38	1807	1760	1710	1710
query39	812	818	746	746
query39_1	742	734	738	734
query40	219	114	100	100
query41	72	67	67	67
query42	86	88	84	84
query43	389	390	343	343
query44	1362	708	712	708
query45	190	182	167	167
query46	854	964	579	579
query47	3011	3027	2857	2857
query48	305	350	214	214
query49	576	388	302	302
query50	686	279	203	203
query51	10766	10499	10412	10412
query52	78	84	68	68
query53	188	210	156	156
query54	238	194	192	192
query55	76	67	62	62
query56	233	216	236	216
query57	1612	1586	1546	1546
query58	283	261	267	261
query59	2104	2117	1939	1939
query60	273	240	223	223
query61	145	140	149	140
query62	397	342	287	287
query63	204	164	172	164
query64	2441	967	773	773
query65	3348	3251	3235	3235
query66	1740	414	297	297
query67	20095	20222	20019	20019
query68	3003	1015	611	611
query69	383	291	260	260
query70	886	803	821	803
query71	290	231	206	206
query72	2765	2616	2250	2250
query73	513	534	295	295
query74	4657	4458	4309	4309
query75	2358	2319	1945	1945
query76	2302	1050	636	636
query77	361	407	292	292
query78	9767	9710	9139	9139
query79	1004	857	514	514
query80	1232	416	348	348
query81	596	315	275	275
query82	576	142	111	111
query83	300	200	187	187
query84	313	124	107	107
query85	854	440	394	394
query86	404	235	231	231
query87	2033	1963	1840	1840
query88	3736	2732	2701	2701
query89	342	292	257	257
query90	1869	187	189	187
query91	166	146	126	126
query92	97	92	80	80
query93	1150	1011	567	567
query94	628	313	266	266
query95	601	404	324	324
query96	665	539	238	238
query97	2442	2424	2317	2317
query98	163	157	148	148
query99	788	772	643	643
Total cold run time: 235308 ms
Total hot run time: 152363 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.59 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 58005f74790d97e25db73c2d1e0851e64e39aa73, data reload: false

query1	0.01	0.01	0.01
query2	0.11	0.05	0.05
query3	0.27	0.12	0.11
query4	1.61	0.12	0.12
query5	0.25	0.25	0.22
query6	1.19	0.69	0.69
query7	0.04	0.00	0.00
query8	0.05	0.03	0.03
query9	0.41	0.35	0.32
query10	0.61	0.64	0.59
query11	0.20	0.14	0.14
query12	0.18	0.15	0.14
query13	0.48	0.48	0.49
query14	1.00	1.00	1.02
query15	0.65	0.60	0.60
query16	0.33	0.36	0.34
query17	1.18	1.17	1.20
query18	0.22	0.20	0.21
query19	2.05	1.99	2.02
query20	0.02	0.01	0.02
query21	15.48	0.29	0.15
query22	4.41	0.05	0.06
query23	16.26	0.33	0.12
query24	2.95	1.26	0.40
query25	0.13	0.07	0.05
query26	1.54	0.25	0.16
query27	0.05	0.04	0.03
query28	2.34	0.66	0.40
query29	12.50	4.26	3.38
query30	0.28	0.14	0.13
query31	2.78	0.57	0.34
query32	3.23	0.61	0.52
query33	3.15	3.20	3.16
query34	15.47	3.99	3.37
query35	3.34	3.36	3.31
query36	0.54	0.48	0.45
query37	0.10	0.07	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.14	0.14
query41	0.08	0.03	0.03
query42	0.04	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 95.82 s
Total hot run time: 24.59 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (6/6) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.18% (35732/46294)
Line Coverage 62.41% (403233/646112)
Region Coverage 58.90% (340702/578440)
Branch Coverage 59.84% (157340/262947)

…ads on demand

### What problem does this PR solve?

Issue Number: None

Related PR: apache#68758

Problem Summary: An unscored conjunction of several terms lists every row of its cheapest term
into an array before the other terms narrow it into another, so a dense conjunction holds
arrays of up to 8 bytes per row of the segment in each scanner (review comment M2 on apache#68758).

For a source that reads on demand, such as a V2 segment, the conjunction now streams: the
cheapest term lists at most 2^16 of its rows at a time, the other terms narrow them, and
the rows left go straight into the result. The other terms keep their current block from
one batch to the next, so each block is still decoded once, and no array holds more than a
batch; a cheapest term of at most 2^16 rows is listed in one batch, as the chain lists it.
A batching source, such as SNII, keeps the chain, which reads each term's blocks in one
round.

On a 2M-row V2 segment the index filter of `alpha beta` drops to 0.76 of the previous
commit, that of `get alpha` to 0.84 and that of `alpha beta get` to 0.89, and their page
faults per query from 458 to 192, 484 to 47 and 447 to 37. Conjunctions whose cheapest
term holds fewer rows, such as `rare alpha`, `sparse alpha` and `rare sparse`, stay between
0.99 and 1.02, and the scan threads run within 1% of the previous commit's instructions.

### Release note

None

### Check List (For Author)

- Test: Unit Test. CursorChainedPostings.AStreamHandsOnABatchOfRowsAtATime,
  AStreamReadsOnlyTheBlocksTheCheapestRowsReach, AStreamEndsWhenACursorEnds and
  AStreamListsTheRowsTheChainLists. ListedTermsTest.AConjunctionOnAStreamingSourceStreamsItsTerms
  replaces AConjunctionOnAStreamingSourceChainsItsTermsToo, which recorded that such a source
  chained its terms; it fails before this change. Each stream test fails when the code it
  covers is broken on purpose. Manual test: the dense MATCH_ALL benchmark with seven more
  shapes, and the 18 queries used to accept apache#68758, which stay between 0.98 and 1.04 of the
  previous commit.
- Behavior changed: No.
- Does this need documentation: No
@airborne12

Copy link
Copy Markdown
Member Author

run buildall

@airborne12

Copy link
Copy Markdown
Member 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.

Reviewed all five changed files at 42beacb, including the MATCH_ALL/boolean invocation chain, CLucene and SNII adapters, shared scored/phrase/gram callers, and changed tests. No substantiated new finding or existing blocking inline finding remains. Review converged in 1 round: both complete-review agents and the separate risk reviewer returned NO_NEW_VALUABLE_FINDINGS, and the main review independently verified their conclusions.

Critical checkpoint conclusions:

  1. Goal: the code implements universal-term skipping, direct lone-term bitmap emission, branchless block intersection, and bounded streaming for on-demand unscored conjunctions. Unit cases exercise each behavior; performance claims were not reproduced.
  2. Scope and reuse: the five-file change is focused and reuses the existing intersection, chain and document-sink mechanisms.
  3. Concurrency: no new threads, locks, atomics or shared mutable query state; groups and cursor operations remain synchronous and local to a query.
  4. Lifecycle and initialization: owning cursors outlive raw observers; lead rows are copied before block advancement, and followers retain cursor-owned blocks only until that cursor advances. Skipped SNII cursors unregister pending callbacks. New static data is constexpr, with no cross-translation-unit initialization dependency.
  5. Configuration: none added or changed.
  6. Compatibility: no persisted format, protocol, dependency or platform API change; the original owning chain_cursors overload is preserved. Release ELF compatibility was not tested.
  7. Thrift/protobuf: no definitions changed, so release-branch field-ID comparisons are not applicable.
  8. Parallel paths: candidate-restricted and batching conjunctions retain chaining; scored conjunction/disjunction and phrase ordinal selection preserve their behavior. Both real sources use the physical row domain for doc_count. NULL documents and scan deletion filtering preserve the universal-term shortcut's semantics.
  9. Conditions: dispatch, block-boundary and EOF branches reflect concrete algorithm states and include reasoning comments; no new silent error suppression was found.
  10. Test coverage: inspected universal/lone-term and candidate cases, both source modes, dense/sparse intersections, cross-batch follower reuse, selective seeks, early EOF and randomized intersections. The random stream oracle independently computes set intersections; the density test checks document output as well as ordinals. Existing NULL, scored and phrase paths were also inspected. No new SQL regression or injected-error case was added.
  11. Test results: no golden-result files changed; expected unit rows, batches and decoded-block counts agree with static control flow. No test execution is claimed.
  12. Observability and errors: new prefetch/read/seek/sink Status values are propagated through existing exception-conversion boundaries and search timers. No additional operational component requiring metrics was introduced.
  13. Transactions and persistence: no logging, replay, transaction, failover or version-selection logic changed.
  14. Writes and atomicity: no write path changed. Existing scan restrictions subtract deletion bitmaps, and index results only narrow the surviving row bitmap.
  15. FE-BE propagation: no new variable or serialized metadata.
  16. Performance and memory: redundant universal reads and lone-term row materialization are removed; streamed scratch vectors each hold at most 65,536 logical rows, with possible geometric capacity slack. Branchless writes stay within the resized output and production callers use distinct input/output buffers. Full allocator accounting and timing were not runtime-verified.
  17. Other checks: no additional correctness, bounds, ownership, include-hygiene or shared-caller regression was substantiated. No additional user focus was supplied.

Validation was static only, as required: no builds, tests, benchmarks or source modifications. The new algorithm tests use fake/blocked cursors; production block ownership, row-domain, seeking and deletion behavior were checked against current Doris code and the exact pinned CLucene dependency. No unresolved review candidate or uncovered changed path remains. There were no pre-existing inline threads to duplicate.

Review converged after 1 round(s).

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17642	5668	5558	5558
q2	2084	314	252	252
q3	10283	1402	856	856
q4	4678	471	342	342
q5	7430	790	534	534
q6	185	187	155	155
q7	745	800	603	603
q8	9233	1366	1113	1113
q9	5438	4288	4271	4271
q10	6802	1270	1031	1031
q11	426	255	237	237
q12	640	396	276	276
q13	18087	3493	2980	2980
q14	271	269	245	245
q15	q16	745	723	667	667
q17	1198	750	589	589
q18	7049	6211	6178	6178
q19	1094	953	629	629
q20	387	336	217	217
q21	4923	2257	2405	2257
q22	362	317	263	263
Total cold run time: 99702 ms
Total hot run time: 29253 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6162	6095	6110	6095
q2	655	560	559	559
q3	5187	5377	4941	4941
q4	2022	2111	1535	1535
q5	5282	5138	6002	5138
q6	258	203	156	156
q7	2266	2040	1818	1818
q8	3214	2860	2805	2805
q9	8128	8116	8020	8020
q10	3921	3771	3350	3350
q11	653	463	389	389
q12	731	719	558	558
q13	3585	3907	3236	3236
q14	323	316	277	277
q15	q16	699	754	663	663
q17	8469	7590	6849	6849
q18	13173	12195	13105	12195
q19	932	821	814	814
q20	2166	2169	1921	1921
q21	5855	4736	4804	4736
q22	499	446	394	394
Total cold run time: 74180 ms
Total hot run time: 66449 ms

@hello-stephen

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

query5	4325	604	438	438
query6	422	205	190	190
query7	4818	444	228	228
query8	324	174	148	148
query9	8748	3877	3891	3877
query10	437	307	254	254
query11	5954	3750	3514	3514
query12	147	92	88	88
query13	1261	427	328	328
query14	6134	4054	3712	3712
query14_1	3510	3525	3481	3481
query15	211	199	186	186
query16	949	434	419	419
query17	866	665	534	534
query18	2438	432	309	309
query19	193	162	142	142
query20	86	85	83	83
query21	215	143	113	113
query22	12919	12955	12672	12672
query23	13548	12707	12557	12557
query23_1	12676	12591	12651	12591
query24	7097	829	469	469
query24_1	470	471	481	471
query25	536	421	366	366
query26	1278	266	145	145
query27	2741	442	271	271
query28	4600	1942	1942	1942
query29	1553	609	481	481
query30	293	216	182	182
query31	993	908	811	811
query32	135	93	89	89
query33	496	302	228	228
query34	873	861	513	513
query35	743	772	643	643
query36	811	794	720	720
query37	128	93	86	86
query38	1788	1750	1707	1707
query39	788	798	749	749
query39_1	723	730	747	730
query40	209	112	93	93
query41	67	64	64	64
query42	89	82	79	79
query43	362	378	324	324
query44	1286	689	682	682
query45	177	177	165	165
query46	872	963	554	554
query47	2999	2977	2901	2901
query48	300	304	214	214
query49	567	394	291	291
query50	703	284	219	219
query51	10269	10292	10555	10292
query52	90	83	70	70
query53	184	204	151	151
query54	230	201	179	179
query55	71	69	70	69
query56	231	218	201	201
query57	1622	1587	1574	1574
query58	283	262	252	252
query59	2157	2169	2017	2017
query60	271	240	222	222
query61	149	142	141	141
query62	393	337	285	285
query63	199	156	169	156
query64	2723	933	821	821
query65	3306	3207	3229	3207
query66	1764	402	306	306
query67	20079	19971	20027	19971
query68	3037	1007	607	607
query69	383	284	247	247
query70	849	788	784	784
query71	289	234	210	210
query72	2752	2536	2279	2279
query73	517	547	299	299
query74	4621	4457	4296	4296
query75	2328	2303	1945	1945
query76	2285	1030	589	589
query77	329	381	277	277
query78	9761	9661	9127	9127
query79	1043	849	523	523
query80	538	416	331	331
query81	530	334	267	267
query82	580	137	112	112
query83	301	195	178	178
query84	303	122	107	107
query85	832	417	384	384
query86	343	246	226	226
query87	2011	1969	1807	1807
query88	3665	2687	2663	2663
query89	330	295	255	255
query90	1854	184	172	172
query91	167	150	128	128
query92	96	88	80	80
query93	1017	1006	573	573
query94	447	306	275	275
query95	589	345	381	345
query96	673	534	236	236
query97	2469	2452	2335	2335
query98	157	149	156	149
query99	780	760	650	650
Total cold run time: 233602 ms
Total hot run time: 151688 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.57 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 42beacb928400a16eb1361629e8603ab1a369ff6, data reload: false

query1	0.01	0.00	0.00
query2	0.11	0.05	0.04
query3	0.26	0.11	0.11
query4	1.61	0.12	0.12
query5	0.24	0.25	0.25
query6	1.17	0.68	0.68
query7	0.04	0.00	0.01
query8	0.06	0.04	0.04
query9	0.40	0.36	0.35
query10	0.58	0.57	0.56
query11	0.20	0.14	0.14
query12	0.19	0.15	0.14
query13	0.49	0.50	0.49
query14	1.01	1.01	1.01
query15	0.64	0.61	0.61
query16	0.35	0.35	0.32
query17	1.18	1.15	1.15
query18	0.22	0.21	0.21
query19	2.02	1.91	2.07
query20	0.02	0.01	0.01
query21	15.50	0.28	0.15
query22	4.56	0.05	0.05
query23	16.23	0.32	0.12
query24	2.92	0.66	0.38
query25	0.12	0.06	0.05
query26	1.18	0.23	0.15
query27	0.04	0.04	0.03
query28	1.75	0.59	0.40
query29	12.57	4.21	3.33
query30	0.28	0.13	0.13
query31	2.79	0.58	0.33
query32	3.22	0.62	0.52
query33	3.25	3.30	3.34
query34	15.53	4.02	3.38
query35	3.33	3.33	3.33
query36	0.56	0.45	0.45
query37	0.10	0.06	0.06
query38	0.05	0.04	0.03
query39	0.04	0.03	0.03
query40	0.17	0.15	0.13
query41	0.09	0.03	0.03
query42	0.04	0.02	0.03
query43	0.04	0.03	0.04
Total cold run time: 95.16 s
Total hot run time: 24.57 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (6/6) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 66.36% (31725/47804)
Line Coverage 51.12% (334080/653564)
Region Coverage 46.47% (269991/580941)
Branch Coverage 48.18% (127130/263861)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (6/6) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.28% (35798/46325)
Line Coverage 62.50% (404086/646579)
Region Coverage 59.02% (341609/578851)
Branch Coverage 59.88% (157628/263220)

@eldenmoon eldenmoon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@airborne12
airborne12 merged commit f937d95 into apache:master Oct 17, 2026
44 checks passed
@airborne12
airborne12 deleted the m2-skip-all-rows-terms branch October 17, 2026 14:25
yiguolei pushed a commit that referenced this pull request Oct 19, 2026
…conjunctions (#69172) (#69239)

### What problem does this PR solve?

Issue Number: N/A

Related PR: #69172, #69206

Problem Summary: Backport #69172 after #69206 introduced the shared
inverted-index query engine to branch-4.2. Dense unscored conjunctions
now skip terms held by every row, write a lone term directly to the
result bitmap, use branch-free block intersection, and bound
streaming-source batches. Query results are unchanged.

Source PR: #69172

Source squash commit: `f937d950d45313f20864d287df453e1b90f5c615`
(cherry-picked with `-x`).

### Release note

None

### Check List (For Author)

- Test
- [x] Regression test: `test_match_format_parity` passed on an isolated
branch-4.2 FE/BE cluster after rebasing onto
`ecd322ad31193cda19cf4f3b08e0f3f9d12dd67c` (1 suite, 0 failures).
- [x] Unit Test: `ListedTermsTest.*:CursorChainedPostings.*` passed (41
tests in 2 suites); all 9 source-added tests were listed and executed.
No sanitizer report.
- [x] Manual test: `./build.sh --be -j64` and `./build.sh --fe -j8`
passed; isolated backend reported `Alive=true`, and `SELECT 1`
succeeded.
- Behavior changed:
- [x] No. Unscored conjunction execution is faster; query results are
unchanged.
- Does this need documentation?
    - [x] No.

### Validation

- `build-support/check-format.sh`: PASS.
- Complete merged-tree format preflight against `origin/branch-4.2`:
PASS.
- Complete PR diff English description check: PASS (5 source files, no
exceptions).
- Branch-4.2 has no `build-support/run-clang-tidy.sh`; the branch's BE
build and format gates passed.

### Hunk audit

The source squash patch ID matches the final source PR head. The
cherry-pick was clean, and every changed file has a byte-identical
postimage to the source commit.

| Source file | Disposition |
| --- | --- |
|
`be/src/storage/index/inverted/query/engine/boolean_query/listed_terms.cpp`
| Ported (verbatim) |
| `be/src/storage/index/inverted/query/exec/cursor_chained_postings.cpp`
| Ported (verbatim) |
| `be/src/storage/index/inverted/query/exec/cursor_chained_postings.h` |
Ported (verbatim) |
|
`be/test/storage/index/inverted/query/engine/boolean_query/listed_terms_test.cpp`
| Ported (verbatim) |
|
`be/test/storage/index/inverted/query/exec/cursor_chained_postings_test.cpp`
| Ported (verbatim) |

`git range-diff` shows only the `-x` cherry-pick provenance line; the
code patch is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants