Skip to content

[fix](function) Fix HLL downsample constant column access - #69799

Merged
hello-stephen merged 2 commits into
apache:masterfrom
Mryange:fix-datasketches-hll-constant-api
Oct 29, 2026
Merged

hello-stephen merged 2 commits into
apache:masterfrom
Mryange:fix-datasketches-hll-constant-api

Conversation

@Mryange

@Mryange Mryange commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #69257, #69679

Problem Summary: The constant-expression API migration in #69679 missed two calls introduced by #69257, breaking the BE build. Call ConstantExprResult::column_ptr() when reading the HLL downsample constant arguments.

Release note

None

Check List (For Author)

  • Test: Local ASAN BE build passed (./build.sh --be -j 48).
  • Behavior changed: No.
  • Does this need documentation: No.

### What problem does this PR solve?

Issue Number: None

Related PR: apache#69257, apache#69679

Problem Summary: The constant-expression API migration missed two HLL
downsample calls, breaking the BE build. Invoke ConstantExprResult::column_ptr()
when reading the constant arguments.

### Release note

None

### Check List (For Author)

- Test: Local ASAN BE build passed (`./build.sh --be -j 48`).
- Behavior changed: No
- 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?

@Mryange

Mryange commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

/review

@Mryange

Mryange commented Oct 29, 2026

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.

No new PR-introduced defect found at c5a9b97. Reviewed the complete authoritative diff: both constant-column accesses in FunctionDataSketchesHllDownsample::open now call the existing ConstantExprResult::column_ptr() accessor. No existing inline findings require revalidation, and no additional user focus was supplied.

Critical checkpoint conclusions:

  1. Goal/proof: the two calls now match the declared API and pass const IColumn references to the parsers. Source inspection supports the intended compile fix; no build was performed for this review.
  2. Scope: two focused accessor corrections in one file.
  3. Concurrency: no new shared mutation, threads or locks. Fragment state remains read-only during execution and shared through context clones.
  4. Lifecycle/static initialization: the constant wrapper owns a non-null, normalized single-row column; parsing consumes it immediately and stores scalar values. No new ownership cycle or static initialization dependency.
  5. Configuration: no settings or dynamic-update behavior changed.
  6. Compatibility: SQL signatures, return types, sketch serialization, storage formats and dependency/toolchain inputs are unchanged; no new libc API dependency is introduced. No binary ABI audit was run.
  7. Thrift/protobuf: no definitions changed; cross-branch field-ID checks are inapplicable.
  8. Parallel paths: both lg_k and optional tgt_type calls are migrated. Default HLL_4, execute fallback and analogous accessor users remain consistent; FE/BE type and nullability contracts are unchanged.
  9. Conditions: no conditional branch changed. Existing constant-availability guards and parser errors remain effective.
  10. Test coverage: inspected existing regression cases for default/explicit types, folded/unfolded/BE-evaluated constants, nullable sketches, string/binary inputs and invalid parameters. Existing unit source also covers open/fallback and nullable invalid parameters, subject to the limitation below. No tests were run.
  11. Test results: no test or expected-output file changed in this PR; no runtime result is claimed.
  12. Observability/errors: no additional instrumentation needed for these accessor corrections; RETURN_IF_ERROR continues to propagate validation failures.
  13. Transactions/persistence: no EditLog, replay, failover or persistence changes.
  14. Writes/atomicity: no data-write or transaction changes; no new crash-cleanup obligation.
  15. FE/BE transport: no new transmitted variables or sending paths.
  16. Performance: the accessor returns a const reference; no added column copy, allocation, materialization or per-row work.
  17. Other invariants/BE obligations: nullable constant handling and fallback remain valid; committed-data visibility, version and delete-bitmap logic are unaffected. No header/include/PCH/template/unity/gate-table changes.

Validation limit: the existing BE unit helper at be/test/exprs/function/function_datasketches_hll_test.cpp:217,224 still refers to the removed ColumnPtrWrapper type. These exact lines and the replacement ConstantExprResult API already coexist at the merge base, so this is a pre-existing test migration gap, not a new inline finding against this two-line patch. Unit-test source coverage does not establish that the target compiles or passes. This review was static only: no builds, tests, benchmarks or runtime validation.

Converged after 1 round: the complete-review and separate constant-API risk reviewers both returned NO_NEW_VALUABLE_FINDINGS; main independently verified the evidence, dismissed the ownership/shape/lifecycle/fallback risk, and deduplicated the pre-existing test limitation. Final sweep covered the full changed-file list and all dispositions; no unresolved candidates or uncovered static-review scope remain.

Review converged after 1 round(s).

OIiveirra added a commit to OIiveirra/doris that referenced this pull request Oct 29, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: apache#69032, apache#69683, apache#69799

Problem Summary: Upstream partition batching and the spatial SPI extension both
used connector API 25.0. Merge official master while retaining both interface
surfaces, advance the spatial extension to 26.0, and update its surface-test pin.
Preserve both spatial constant-folding protection and upstream HLL exclusions.
Apply the two approved HLL constant-result getter calls equivalent to apache#69799;
do not change HLL algorithms or its tests. Spatial functionality and ordinary-key
spatial-value support remain unchanged.

### Release note

None

### Check List (For Author)

- Test: Standard ASAN BE+FE build and Checkstyle; selected FE UT 219/219
  (including SPI 153/153); GIS, Iceberg and VARBINARY native regressions;
  API26 resource and ten connector manifests; format16, hygiene and changed-line
  clang-tidy. BE UT compilation is blocked before execution by unchanged upstream
  HLL test references to the removed ColumnPtrWrapper; no passing BE UT is claimed.
- Behavior changed: No. Preserve both parent features and distinguish the spatial
  SPI major version from upstream partition batching.
- Does this need documentation: No. Internal merge/API reconciliation; public
  spatial contracts in apache/doris-website#4239 remain unchanged.
@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17595	5177	5069	5069
q2	2137	301	255	255
q3	10255	1394	840	840
q4	4674	455	331	331
q5	7445	818	530	530
q6	180	184	157	157
q7	773	801	590	590
q8	9387	1312	1149	1149
q9	5515	4216	4209	4209
q10	6829	1298	1034	1034
q11	433	244	225	225
q12	633	396	282	282
q13	18137	3620	3095	3095
q14	277	270	247	247
q15	q16	740	713	650	650
q17	1234	756	575	575
q18	6989	6202	6147	6147
q19	1126	979	633	633
q20	400	345	227	227
q21	4808	2112	2280	2112
q22	352	296	251	251
Total cold run time: 99919 ms
Total hot run time: 28608 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5617	5552	5603	5552
q2	686	575	531	531
q3	5242	5441	4925	4925
q4	1997	2120	1549	1549
q5	5278	5141	5664	5141
q6	255	203	156	156
q7	2338	2140	1890	1890
q8	3100	2821	2767	2767
q9	8178	8266	8056	8056
q10	3769	3690	3239	3239
q11	598	441	414	414
q12	698	692	518	518
q13	3627	3908	3254	3254
q14	305	309	291	291
q15	q16	691	726	681	681
q17	8324	7544	6847	6847
q18	13040	12194	12835	12194
q19	920	809	798	798
q20	2173	2171	1946	1946
q21	5587	4582	4660	4582
q22	530	478	448	448
Total cold run time: 72953 ms
Total hot run time: 65779 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 c5a9b9793b77f788095221d02b723db0a3f2e06b, data reload: false

query5	4309	582	454	454
query6	444	204	190	190
query7	4816	470	234	234
query8	319	167	152	152
query9	8922	3244	3233	3233
query10	488	303	250	250
query11	6016	3875	3573	3573
query12	149	98	91	91
query13	1247	444	318	318
query14	6144	3890	3704	3704
query14_1	3401	3426	3432	3426
query15	208	198	183	183
query16	957	464	436	436
query17	869	664	529	529
query18	2433	421	319	319
query19	200	161	136	136
query20	89	87	82	82
query21	213	126	107	107
query22	12963	12983	12784	12784
query23	13577	12913	12486	12486
query23_1	12475	12588	12506	12506
query24	7342	828	485	485
query24_1	493	487	500	487
query25	535	423	363	363
query26	1268	267	141	141
query27	2757	448	286	286
query28	4622	2071	2071	2071
query29	1584	609	488	488
query30	301	223	197	197
query31	997	926	810	810
query32	154	90	89	89
query33	533	291	253	253
query34	940	850	507	507
query35	724	749	634	634
query36	856	802	719	719
query37	122	90	81	81
query38	1789	1735	1676	1676
query39	778	783	750	750
query39_1	730	726	750	726
query40	222	129	93	93
query41	65	61	61	61
query42	84	82	82	82
query43	347	367	306	306
query44	1340	712	721	712
query45	173	179	165	165
query46	840	960	563	563
query47	2869	2797	2746	2746
query48	313	309	225	225
query49	578	415	294	294
query50	693	290	217	217
query51	10433	10361	10326	10326
query52	77	90	69	69
query53	192	207	150	150
query54	234	198	181	181
query55	77	69	65	65
query56	227	230	225	225
query57	1660	1623	1569	1569
query58	287	273	267	267
query59	2129	2217	1972	1972
query60	289	277	220	220
query61	149	151	149	149
query62	388	345	283	283
query63	195	166	163	163
query64	2737	911	756	756
query65	3363	3254	3293	3254
query66	1769	419	297	297
query67	20363	20133	20071	20071
query68	3155	1039	637	637
query69	404	294	255	255
query70	830	776	758	758
query71	301	247	221	221
query72	2923	2601	2377	2377
query73	533	536	301	301
query74	4654	4498	4397	4397
query75	2346	2282	1904	1904
query76	2387	1014	592	592
query77	358	373	272	272
query78	9669	9755	9226	9226
query79	1051	885	545	545
query80	549	424	352	352
query81	531	320	275	275
query82	588	136	106	106
query83	300	195	188	188
query84	306	121	103	103
query85	856	434	369	369
query86	329	237	238	237
query87	2000	1909	1791	1791
query88	3856	2800	2773	2773
query89	333	279	243	243
query90	1841	161	170	161
query91	158	150	128	128
query92	101	92	91	91
query93	1054	993	593	593
query94	471	304	278	278
query95	587	376	307	307
query96	704	498	243	243
query97	2458	2428	2343	2343
query98	164	156	145	145
query99	784	764	672	672
Total cold run time: 235065 ms
Total hot run time: 151688 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.09	0.06	0.05
query3	0.26	0.09	0.09
query4	1.61	0.11	0.10
query5	0.24	0.24	0.23
query6	1.17	0.68	0.67
query7	0.04	0.01	0.00
query8	0.06	0.04	0.04
query9	0.40	0.36	0.35
query10	0.58	0.58	0.57
query11	0.20	0.14	0.13
query12	0.18	0.14	0.15
query13	0.48	0.48	0.48
query14	1.02	1.00	1.00
query15	0.61	0.60	0.60
query16	0.34	0.35	0.34
query17	1.09	1.17	1.16
query18	0.20	0.19	0.19
query19	2.15	1.98	2.07
query20	0.02	0.02	0.01
query21	15.42	0.19	0.13
query22	4.96	0.05	0.06
query23	16.26	0.33	0.12
query24	3.07	0.49	0.35
query25	0.12	0.06	0.05
query26	1.25	0.22	0.15
query27	0.05	0.04	0.05
query28	3.22	0.80	0.35
query29	12.48	4.13	3.25
query30	0.28	0.13	0.12
query31	2.77	0.56	0.32
query32	3.24	0.59	0.50
query33	3.20	3.31	3.19
query34	15.36	3.98	3.37
query35	3.35	3.38	3.32
query36	0.56	0.47	0.45
query37	0.09	0.06	0.06
query38	0.04	0.04	0.04
query39	0.03	0.03	0.03
query40	0.16	0.14	0.14
query41	0.08	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 96.82 s
Total hot run time: 24.26 s

### What problem does this PR solve?

Issue Number: None

Related PR: apache#69799

Problem Summary: The HLL downsample unit test still constructs the removed ColumnPtrWrapper after the constant-expression API migration. Use ConstantExprResult to match FunctionContext::set_constant_cols and fix the two undeclared-identifier errors in BE UT CI build 1085144.

### Release note

None

### Check List (For Author)

- Test: clang-format 16 dry-run, git diff --check, and build hygiene passed. Local compilation and tests skipped as requested; CI compilation pending.
- Behavior changed: No
- Does this need documentation: No
@morningman

Copy link
Copy Markdown
Contributor

run compile

@Mryange

Mryange commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@Mryange

Mryange commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

/review

@hello-stephen

Copy link
Copy Markdown
Contributor

skip buildall

@hello-stephen
hello-stephen merged commit ee6969e into apache:master Oct 29, 2026
38 of 39 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Review recovery stopped: PR base/head or open state changed; refusing to resume stale context
Workflow run: https://github.com/apache/doris/actions/runs/40829312159

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (2/2) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 67.16% (32481/48361)
Line Coverage 52.04% (344010/660997)
Region Coverage 47.47% (279503/588828)
Branch Coverage 49.14% (131861/268331)

OIiveirra added a commit to OIiveirra/doris that referenced this pull request Oct 29, 2026
### What problem does this PR solve?

Related PR: apache#69032, apache#69799

Problem Summary: The spatial branch inherited HLL unit tests using the removed ColumnPtrWrapper. Merge official master containing apache#69799 so focused spatial verification can use the standard BE UT entry point. The merge is conflict-free and matches the independently simulated tree; no manual product changes are added.

### Release note

None

### Check List (For Author)

- Test: Manual merge-tree and staged-tree comparison; standard builds and focused tests follow in the spatial fix.
- Behavior changed: No additional task-specific behavior change
- Does this need documentation: No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants