Skip to content

[fix](be) Pass uint64_t offsets to the ANN index writer in unit tests - #69584

Merged
csun5285 merged 1 commit into
apache:masterfrom
morningman:b2m-t37d-macos-ann-test-offsets
Oct 25, 2026
Merged

csun5285 merged 1 commit into
apache:masterfrom
morningman:b2m-t37d-macos-ann-test-offsets

Conversation

@morningman

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #69070

Problem Summary:

In short. Since #69070, the BE unit tests no longer compile on macOS: three ANN tests pass std::vector<size_t>::data() where the writer now takes const uint64_t*. The tests now use std::vector<uint64_t>.

Background. #69070 changed the offsets parameter of the ANN index writers' add_array_values() from const uint8_t* to const uint64_t*. The vector_search_test library, which holds the ANN tests, is force-loaded into doris_be_test.

The problem, and what it cost. ann_index_writer_test.cpp (15 places), ann_index_edge_case_test.cpp and snii_ann_container_test.cpp still build their offsets as std::vector<size_t>. On Linux size_t and uint64_t are both unsigned long, so they compile. On macOS size_t is unsigned long and uint64_t is unsigned long long, and the build stops at:

ann_index_edge_case_test.cpp:274:55: error: cannot initialize a parameter of type 'const uint64_t *' (aka 'const unsigned long long *') with an rvalue of type 'value_type *' (aka 'unsigned long *')

Because vector_search_test is linked into doris_be_test, no BE unit test can be built on macOS. The macOS CI pipeline builds the BE without tests, so CI does not report it.

How this PR fixes it. The 17 offsets vectors in those tests are declared as std::vector<uint64_t>, the type the writer takes. Production code is unchanged.

Results.

macOS BE UT build
Before stops at ann_index_edge_case_test.cpp
After links doris_be_test; the ANN tests pass

Release note

None

Check List (For Author)

  • Test
    • Regression test
    • Unit Test
      • macOS (clang 22, ASAN): AnnIndexWriterTest (27), VectorSearchTest (66) and SniiAnnContainerTest (20) pass.
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
  • 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

### What problem does this PR solve?

Issue Number: None

Related PR: apache#69070

Problem Summary: apache#69070 changed the offsets parameter of the ANN index
writers' add_array_values() to const uint64_t*, but three unit tests
still build their offsets as std::vector<size_t> and pass
offsets.data(): ann_index_writer_test.cpp (15 places),
ann_index_edge_case_test.cpp and snii_ann_container_test.cpp. On Linux
size_t and uint64_t are both unsigned long, so the tests compile. On
macOS size_t is unsigned long and uint64_t is unsigned long long, and
ann_index_edge_case_test.cpp fails with "cannot initialize a parameter
of type 'const uint64_t *' (aka 'const unsigned long long *') with an
rvalue of type 'value_type *' (aka 'unsigned long *')". The
vector_search_test library is force-loaded into doris_be_test, so no
BE unit test builds on macOS. The macOS CI pipeline builds the BE
without tests and does not see it.

These tests now declare the offsets as std::vector<uint64_t>, the type
the writer takes. Production code is unchanged.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - macOS: the BE UT build compiles the three files and links
      doris_be_test again; AnnIndexWriterTest, VectorSearchTest and
      SniiAnnContainerTest pass.
- Behavior changed: No
- Does this need documentation: No

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@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?

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@morningman

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.

Reviewed all 17 offset-vector type replacements across the three changed BE test files at head 29debc8. No actionable findings. The declarations now exactly match the existing const uint64_t* parameter in both IndexColumnWriter and AnnIndexColumnWriter; offset values, lengths, row counts, and assertions are preserved. Existing inline findings: none. Additional user-provided focus: none.

Critical checkpoint conclusions:

Checkpoint Conclusion
Goal and proof The source fixes the reported macOS pointer-type mismatch. Existing ANN/SNII tests exercise the calls and CMake includes them in doris_be_test; build success is not independently verified.
Scope and clarity Minimal: 17 declaration-only changes (15 writer tests, one large-dimension test, one SNII helper); production code is unchanged.
Concurrency and locks No thread, shared-state access, lock, or synchronization changes.
Lifecycle and static initialization Local vectors remain alive during synchronous offset consumption; the callee retains no offset pointer. No static initialization changes.
Configuration No configuration additions or dynamic-setting behavior changes. Existing test configuration handling is unchanged.
Compatibility No production ABI, storage-format, rolling-upgrade, or glibc dependency changes.
Thrift/protobuf IDs No gensrc changes.
Parallel paths Direct, virtual-base, HNSW/IVF, buffered-build, and SNII callers checked. The unchanged smoke test already explicitly casts its pointer, so it has no equivalent direct-pointer compilation mismatch.
Conditional checks No conditions or failure branches changed.
Test coverage Existing tests cover success, wrong dimensions, zero rows, batching, build thresholds, large dimensions, and SNII round trips/failure propagation. Tests were inspected, not executed.
Test results No expected-result files or assertions changed; initialized offset values are preserved and representable as uint64_t.
Observability No new production operation requires logs or metrics.
Transactions and persistence No transaction, EditLog, replay, failover, version-visibility, or delete-bitmap changes. Existing index persistence tests are preserved.
Writes and atomicity Only test input declarations change; index write flow, failure propagation, and atomicity are unchanged.
FE/BE variables No new transmitted variables or protocol paths.
Performance and memory No algorithmic change, additional allocation, redundant computation, or new memory-accounting path. Buffer bounds and ownership are preserved.
Other issues and conventions No new error-handling, nullable-column, include-layering, PCH, explicit-instantiation, unity-build, or test-order dependency issue identified.

Review converged in round 1 after full changed-file coverage, independent review, and the final sweep. No unresolved candidates or uncovered changed paths remain. Validation limit: static review only, as required; no builds or tests were run, and the author's macOS execution results were not independently reproduced.

Review converged after 1 round(s).

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17598	5186	5091	5091
q2	2134	346	275	275
q3	10177	1366	835	835
q4	4707	467	338	338
q5	7625	805	533	533
q6	186	186	157	157
q7	755	802	608	608
q8	10234	1334	1100	1100
q9	5761	4168	4181	4168
q10	6887	1303	1015	1015
q11	433	251	231	231
q12	649	400	278	278
q13	18154	3682	3048	3048
q14	276	285	252	252
q15	q16	733	728	673	673
q17	1203	742	573	573
q18	7083	6196	6119	6119
q19	1244	959	607	607
q20	396	345	232	232
q21	5302	2172	2298	2172
q22	355	295	253	253
Total cold run time: 101892 ms
Total hot run time: 28558 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5617	5614	5629	5614
q2	675	582	547	547
q3	5214	5401	4908	4908
q4	2001	2151	1550	1550
q5	5291	5169	5178	5169
q6	238	186	141	141
q7	2085	1860	1710	1710
q8	2875	2495	2501	2495
q9	7554	7516	7511	7511
q10	3666	3602	3177	3177
q11	590	425	432	425
q12	678	706	512	512
q13	3329	3685	3011	3011
q14	291	314	264	264
q15	q16	660	689	627	627
q17	7837	7057	6860	6860
q18	12970	12212	12840	12212
q19	898	792	807	792
q20	2154	2136	1941	1941
q21	5666	4674	4806	4674
q22	501	447	413	413
Total cold run time: 70790 ms
Total hot run time: 64553 ms

@hello-stephen

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

query5	4310	596	462	462
query6	431	212	188	188
query7	4794	449	231	231
query8	321	168	159	159
query9	8795	3126	3110	3110
query10	449	324	252	252
query11	5900	3876	3582	3582
query12	150	97	88	88
query13	1238	454	351	351
query14	6067	3979	3686	3686
query14_1	3425	3433	3399	3399
query15	205	201	186	186
query16	924	439	336	336
query17	871	699	540	540
query18	2418	431	316	316
query19	217	168	138	138
query20	88	84	85	84
query21	214	132	108	108
query22	12874	13088	12819	12819
query23	13614	13014	12427	12427
query23_1	12522	12567	12626	12567
query24	7362	855	484	484
query24_1	471	474	493	474
query25	535	448	380	380
query26	1254	262	145	145
query27	2761	441	277	277
query28	4622	1940	1969	1940
query29	1576	623	464	464
query30	302	221	192	192
query31	1006	926	829	829
query32	152	96	96	96
query33	540	311	251	251
query34	911	884	503	503
query35	740	774	649	649
query36	793	808	726	726
query37	121	99	84	84
query38	1759	1738	1657	1657
query39	800	821	758	758
query39_1	754	736	756	736
query40	226	126	100	100
query41	74	71	69	69
query42	88	87	87	87
query43	349	365	309	309
query44	1317	694	702	694
query45	181	187	168	168
query46	806	967	579	579
query47	2977	3068	2868	2868
query48	321	352	231	231
query49	568	395	294	294
query50	675	288	205	205
query51	10424	10342	10161	10161
query52	79	80	71	71
query53	194	201	153	153
query54	262	211	175	175
query55	71	65	73	65
query56	223	217	224	217
query57	1658	1599	1552	1552
query58	291	273	262	262
query59	2107	2086	1922	1922
query60	298	244	234	234
query61	146	144	149	144
query62	390	327	300	300
query63	185	164	164	164
query64	2752	972	756	756
query65	3350	3279	3300	3279
query66	1842	421	312	312
query67	20118	20068	19989	19989
query68	2970	996	621	621
query69	385	287	245	245
query70	845	773	772	772
query71	293	239	197	197
query72	2773	2566	2282	2282
query73	514	538	295	295
query74	4659	4529	4372	4372
query75	2352	2263	1917	1917
query76	2330	1015	591	591
query77	351	379	271	271
query78	9910	9769	9143	9143
query79	995	859	522	522
query80	1280	439	341	341
query81	611	319	273	273
query82	636	139	115	115
query83	312	199	182	182
query84	322	128	105	105
query85	874	416	366	366
query86	407	246	229	229
query87	2024	1975	1789	1789
query88	3705	2682	2648	2648
query89	341	283	250	250
query90	1923	174	168	168
query91	169	150	128	128
query92	101	89	89	89
query93	1044	1015	579	579
query94	650	307	265	265
query95	574	395	301	301
query96	658	494	233	233
query97	2466	2422	2303	2303
query98	164	152	150	150
query99	776	766	654	654
Total cold run time: 235338 ms
Total hot run time: 150901 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.10	0.05	0.05
query3	0.26	0.09	0.10
query4	1.62	0.10	0.10
query5	0.24	0.25	0.24
query6	1.17	0.68	0.68
query7	0.05	0.01	0.01
query8	0.06	0.04	0.04
query9	0.39	0.36	0.34
query10	0.57	0.57	0.58
query11	0.21	0.16	0.14
query12	0.18	0.16	0.14
query13	0.50	0.51	0.50
query14	1.04	1.01	1.00
query15	0.66	0.63	0.64
query16	0.35	0.35	0.34
query17	1.10	1.11	1.12
query18	0.22	0.18	0.18
query19	2.10	2.04	1.97
query20	0.02	0.02	0.01
query21	15.45	0.21	0.14
query22	4.70	0.05	0.04
query23	16.27	0.31	0.13
query24	3.16	0.56	0.40
query25	0.11	0.06	0.05
query26	1.22	0.21	0.15
query27	0.05	0.03	0.06
query28	3.46	0.77	0.37
query29	12.52	4.18	3.27
query30	0.28	0.14	0.13
query31	2.78	0.56	0.33
query32	3.22	0.60	0.50
query33	3.21	3.19	3.17
query34	15.22	4.06	3.43
query35	3.34	3.36	3.35
query36	0.57	0.43	0.42
query37	0.10	0.07	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.16	0.15
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 96.95 s
Total hot run time: 24.43 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.63% (31962/47972)
Line Coverage 51.40% (337158/655923)
Region Coverage 46.79% (272987/583398)
Branch Coverage 48.52% (128666/265161)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.33% (35940/46479)
Line Coverage 62.59% (406108/648890)
Region Coverage 59.04% (343214/581281)
Branch Coverage 60.03% (158776/264508)

@csun5285
csun5285 merged commit 7679a4f into apache:master Oct 25, 2026
38 checks passed
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.

3 participants