Skip to content

[fix](variant) Prefer sparse variant fields over root value#65660

Merged
eldenmoon merged 2 commits into
apache:masterfrom
eldenmoon:branch-fix-doris-27147
Jul 23, 2026
Merged

[fix](variant) Prefer sparse variant fields over root value#65660
eldenmoon merged 2 commits into
apache:masterfrom
eldenmoon:branch-fix-doris-27147

Conversation

@eldenmoon

@eldenmoon eldenmoon commented Jul 15, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: A distributed ordered query using TopN lazy materialization could return an array root such as [] instead of the object fields stored in a VARIANT row. Root visibility already considered dense subcolumns and document snapshots but ignored sparse subcolumns, so a non-null root incorrectly won during serialization. Check the current row sparse offsets before treating the root as visible. Before the fix the reproduced row returned []; after the fix it returns {"n":7,"word":"hot"}.

Release note

Fix incorrect VARIANT results in TopN lazy queries when object fields are stored in sparse columns.

Check List (For Author)

  • Test:
    • Unit Test: ColumnVariantTest.visible_root_does_not_hide_sparse_fields
    • Regression test: variant_p0/test_topn_lazy_materialize_sparse_variant
    • ASAN BE build
  • Behavior changed: Yes. Sparse object fields now take precedence over a non-array root during VARIANT serialization.
  • Does this need documentation: No

Copilot AI review requested due to automatic review settings July 15, 2026 10:47
@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?

@eldenmoon

Copy link
Copy Markdown
Member Author

run buildall

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

Fixes incorrect VARIANT serialization results in distributed ordered queries by preserving sparse/dense subcolumn structure during row copy, materializing pending default suffixes, and ensuring root-value visibility logic does not mask sparse/object fields.

Changes:

  • Add a regression test that exercises TopN lazy materialization with sparse VARIANT subcolumns.
  • Add BE unit tests covering pending-default-suffix materialization, sparse-limit preservation, and mixed root+sparse visibility.
  • Adjust ColumnVariant row-copy and root-visibility logic to better preserve sparse/doc_value structure.

Review Checkpoints (skill Part 1.3)

  • Goal & proof: Goal is clear (preserve sparse variant fields during row copy); covered by the added regression + unit tests.
  • Scope/focus: Changes are localized to ColumnVariant copy/visibility plus targeted tests.
  • Concurrency: No new concurrency/locking introduced in the touched code paths.
  • Lifecycle/static init: No new static/global lifecycle concerns introduced.
  • Config items: No new configs added (only test session variables).
  • Compatibility/storage format: No explicit on-disk format change shown in this diff; behavior change is in copy/serialization logic.
  • Parallel code paths: insert_from() now funnels mixed-shape copies through insert_range_from(); this appears to be the intended consolidation.
  • Special conditional checks: New visibility logic adds sparse offsets consideration; one indexing detail needs adjustment (see PR comment).
  • Test coverage: Regression + 3 unit tests added; seems appropriate for this bug fix.
  • Observability: No new logging/metrics; likely fine for this narrowly scoped correctness fix.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
regression-test/suites/variant_p0/test_topn_lazy_materialize_sparse_variant.groovy Adds a regression scenario for TopN lazy materialization over sparse VARIANT data.
regression-test/data/variant_p0/test_topn_lazy_materialize_sparse_variant.out Captures the expected query output for the new regression case.
be/test/core/column/column_variant_test.cpp Adds focused unit tests for row-copy default suffixes, sparse limits, and root visibility with sparse fields.
be/src/core/column/column_variant.cpp Updates VARIANT subcolumn range-copy, row-copy behavior, and root visibility checks to preserve sparse structure.

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

Comment thread be/src/core/column/column_variant.cpp Outdated
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: A distributed ordered query using TopN lazy materialization could return an array root such as [] instead of the object fields stored in a VARIANT row. Root visibility already considered dense subcolumns and document snapshots but ignored sparse subcolumns, so a non-null root incorrectly won during serialization. Check the current row sparse offsets before treating the root as visible. Before the fix the reproduced row returned []; after the fix it returns {"n":7,"word":"hot"}.

### Release note

Fix incorrect VARIANT results in TopN lazy queries when object fields are stored in sparse columns.

### Check List (For Author)

- Test:
    - Unit Test: ColumnVariantTest.visible_root_does_not_hide_sparse_fields
    - Regression test: variant_p0/test_topn_lazy_materialize_sparse_variant
    - ASAN BE build
- Behavior changed: Yes. Sparse object fields now take precedence over a non-array root during VARIANT serialization.
- Does this need documentation: No
@eldenmoon
eldenmoon force-pushed the branch-fix-doris-27147 branch from 513c12a to 48973fb Compare July 15, 2026 12:45
@eldenmoon eldenmoon changed the title [fix](be) Preserve sparse variant fields during row copy [fix](be) Prefer sparse variant fields over root value Jul 15, 2026
@eldenmoon

Copy link
Copy Markdown
Member Author

run buildall

@eldenmoon

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.

Review completed for PR 65660 at head 48973fb.

I found two correctness issues that should be fixed before merge:

  • The new sparse-visibility guard can still lose sparse rows when doc-value offsets are present from earlier rows in mixed-format/compatibility rowsets.
  • The new regression expected output records [] for rows inserted as {}, which would lock in object-to-array corruption.

Checkpoint summary: I reviewed the changed ColumnVariant serialization/copying code, the TopN lazy materialization row-id fetch/scatter path, storage variant sparse/doc read/write interactions, and the new BE/regression tests. Existing review context was checked; the existing nrow - 1/PaddedPODArray thread is not duplicated here. User focus file had no additional focus. Validation was static only, per the review prompt; I did not run builds or tests.

}
}

const auto& sparse_offsets = serialized_sparse_column_offsets();

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.

This still misses sparse rows after any prior doc-snapshot row. Once this new check returns false for a row with sparse entries, serialize_one_row_to_json_format() immediately tests doc_value_column_map.get_offsets()[row_num] != 0; that is the cumulative end offset, so it remains true for later rows even when the current row has no doc-value entries. If a result column is assembled from mixed-format or compatibility rowsets where an earlier segment has doc-value snapshots and a later row has sparse entries, the sparse row can serialize as {} and return before the sparse map below is considered. Please gate the doc snapshot branch with the current-row delta, e.g. the existing has_doc_value_column(row_num) / offsets[row_num - 1] < offsets[row_num], and add a unit case with a prior doc row and a current sparse row.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

need to fix in new mem layout

4 -9223372036854775808 [1,2,3] {"k":1}
6 1 [1,2,3] {}
7 0 [1,2,3] [1,2,3]
9 \N {} []

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.

This expected row does not match the inserted value. The suite inserts col_variant = '{}' for pk 9 (and again for pk 15), but the new oracle records []. Other rows inserted as {} in this same output remain {}, so this is not just a display convention; it locks in an object-to-array change in the regression that is supposed to protect VARIANT materialization correctness. Please fix the underlying serialization case and regenerate this as {} (or remove these rows from this regression and cover the object/array issue separately).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

need to fix in new mem layout

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17651	4034	4007	4007
q2	2031	324	207	207
q3	10248	1384	858	858
q4	4703	471	335	335
q5	7644	860	566	566
q6	200	173	138	138
q7	756	799	640	640
q8	9998	1625	1526	1526
q9	6019	4373	4321	4321
q10	6788	1755	1474	1474
q11	495	339	308	308
q12	762	556	424	424
q13	18108	3454	2753	2753
q14	275	261	244	244
q15	q16	782	784	705	705
q17	2577	1129	735	735
q18	6843	5873	5462	5462
q19	1651	1248	1049	1049
q20	750	646	517	517
q21	5840	2711	2447	2447
q22	437	352	294	294
Total cold run time: 104558 ms
Total hot run time: 29010 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4393	4322	4400	4322
q2	306	320	212	212
q3	4560	4912	4411	4411
q4	2067	2153	1382	1382
q5	4433	4229	4258	4229
q6	223	174	132	132
q7	2243	1888	1580	1580
q8	2460	2108	2103	2103
q9	7862	7705	7812	7705
q10	4690	4621	4196	4196
q11	738	412	367	367
q12	736	764	563	563
q13	3332	3609	2979	2979
q14	285	304	275	275
q15	q16	705	738	630	630
q17	1338	1325	1320	1320
q18	8030	7519	6652	6652
q19	1079	1039	1060	1039
q20	2219	2225	1940	1940
q21	5266	4576	4500	4500
q22	524	473	396	396
Total cold run time: 57489 ms
Total hot run time: 50933 ms

@hello-stephen

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

query5	4299	635	485	485
query6	468	219	197	197
query7	4837	615	348	348
query8	348	192	178	178
query9	8770	4034	4051	4034
query10	469	357	309	309
query11	5754	2326	2152	2152
query12	181	110	108	108
query13	1265	588	415	415
query14	6230	5228	4909	4909
query14_1	4258	4292	4252	4252
query15	223	209	185	185
query16	1039	499	439	439
query17	1111	721	537	537
query18	2757	462	332	332
query19	226	180	144	144
query20	114	104	104	104
query21	231	157	132	132
query22	13695	13580	13347	13347
query23	17287	16471	16082	16082
query23_1	16162	16331	16591	16331
query24	7514	1753	1262	1262
query24_1	1298	1286	1263	1263
query25	542	437	361	361
query26	1310	330	205	205
query27	2618	599	388	388
query28	4464	2048	2024	2024
query29	1052	595	469	469
query30	341	257	219	219
query31	1114	1090	977	977
query32	110	60	62	60
query33	515	317	247	247
query34	1161	1104	642	642
query35	764	786	672	672
query36	1276	1193	1053	1053
query37	155	109	94	94
query38	1860	1705	1659	1659
query39	882	866	835	835
query39_1	843	825	848	825
query40	247	161	140	140
query41	72	67	73	67
query42	98	92	94	92
query43	330	328	282	282
query44	1425	762	770	762
query45	206	195	180	180
query46	1097	1208	749	749
query47	2173	2107	1996	1996
query48	392	425	296	296
query49	588	432	314	314
query50	1092	408	325	325
query51	10800	10722	10574	10574
query52	89	91	76	76
query53	278	270	204	204
query54	302	244	247	244
query55	111	69	64	64
query56	300	282	276	276
query57	1320	1308	1178	1178
query58	274	252	246	246
query59	1583	1635	1436	1436
query60	304	270	248	248
query61	149	148	147	147
query62	543	489	429	429
query63	241	200	196	196
query64	2779	1042	865	865
query65	4738	4624	4613	4613
query66	1758	492	373	373
query67	29254	29266	29023	29023
query68	3378	1534	972	972
query69	410	292	263	263
query70	1060	964	956	956
query71	349	315	322	315
query72	3046	2633	2379	2379
query73	870	754	423	423
query74	5121	4891	4695	4695
query75	2503	2484	2124	2124
query76	2340	1181	748	748
query77	341	384	296	296
query78	11751	11974	11290	11290
query79	1383	1142	778	778
query80	1021	527	454	454
query81	504	315	267	267
query82	556	153	121	121
query83	386	320	291	291
query84	282	160	134	134
query85	967	590	499	499
query86	402	319	266	266
query87	1826	1831	1741	1741
query88	3688	2782	2794	2782
query89	435	370	332	332
query90	1847	197	194	194
query91	201	192	166	166
query92	65	63	57	57
query93	1495	1503	947	947
query94	625	362	307	307
query95	798	560	476	476
query96	1147	806	362	362
query97	2603	2615	2508	2508
query98	211	207	205	205
query99	1086	1112	989	989
Total cold run time: 263093 ms
Total hot run time: 177266 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.10	0.05	0.05
query3	0.26	0.14	0.14
query4	1.60	0.13	0.14
query5	0.24	0.25	0.24
query6	1.28	1.08	1.07
query7	0.04	0.00	0.00
query8	0.05	0.03	0.04
query9	0.38	0.32	0.30
query10	0.54	0.59	0.56
query11	0.20	0.14	0.14
query12	0.19	0.14	0.15
query13	0.47	0.47	0.47
query14	1.01	1.01	1.01
query15	0.61	0.61	0.61
query16	0.31	0.33	0.32
query17	1.12	1.08	1.07
query18	0.23	0.23	0.22
query19	2.04	1.95	1.94
query20	0.01	0.02	0.01
query21	15.42	0.22	0.15
query22	4.81	0.06	0.05
query23	16.11	0.29	0.12
query24	2.98	0.41	0.35
query25	0.11	0.05	0.04
query26	0.71	0.20	0.14
query27	0.05	0.03	0.03
query28	3.59	0.94	0.53
query29	12.45	4.10	3.28
query30	0.28	0.16	0.15
query31	2.77	0.59	0.31
query32	3.22	0.59	0.50
query33	3.19	3.22	3.21
query34	15.56	4.24	3.53
query35	3.58	3.51	3.54
query36	0.56	0.42	0.42
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.03	0.04
query40	0.18	0.16	0.17
query41	0.08	0.03	0.03
query42	0.04	0.04	0.04
query43	0.04	0.04	0.04
Total cold run time: 96.58 s
Total hot run time: 25.17 s

@eldenmoon

Copy link
Copy Markdown
Member Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17824	4058	4113	4058
q2	1995	318	196	196
q3	10298	1378	824	824
q4	4682	474	337	337
q5	7526	851	570	570
q6	204	171	138	138
q7	759	830	604	604
q8	9834	1585	1580	1580
q9	6014	4319	4328	4319
q10	6826	1742	1442	1442
q11	505	350	318	318
q12	759	580	462	462
q13	18104	3298	2710	2710
q14	272	272	234	234
q15	q16	782	778	702	702
q17	1002	938	962	938
q18	6839	5753	5644	5644
q19	1629	1202	992	992
q20	793	706	546	546
q21	6043	2576	2495	2495
q22	416	349	297	297
Total cold run time: 103106 ms
Total hot run time: 29406 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4421	4327	4395	4327
q2	307	329	216	216
q3	4624	4984	4402	4402
q4	2049	2169	1354	1354
q5	4407	4278	4258	4258
q6	230	181	131	131
q7	1721	2136	1629	1629
q8	2571	2211	2044	2044
q9	7818	7823	7801	7801
q10	4717	4626	4194	4194
q11	580	401	375	375
q12	861	806	536	536
q13	3316	3690	3007	3007
q14	293	291	272	272
q15	q16	713	742	658	658
q17	1383	1332	1357	1332
q18	8102	7539	7162	7162
q19	1102	1058	1087	1058
q20	2224	2205	1923	1923
q21	5309	4647	4470	4470
q22	511	445	401	401
Total cold run time: 57259 ms
Total hot run time: 51550 ms

@hello-stephen

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

query5	4316	610	471	471
query6	466	216	196	196
query7	4846	568	342	342
query8	333	200	173	173
query9	8739	4053	4089	4053
query10	450	366	312	312
query11	5867	2323	2128	2128
query12	153	111	106	106
query13	1262	618	452	452
query14	6272	5263	4902	4902
query14_1	4281	4242	4299	4242
query15	228	206	179	179
query16	1030	457	464	457
query17	1129	725	580	580
query18	2517	502	341	341
query19	214	191	149	149
query20	110	109	105	105
query21	230	162	139	139
query22	13562	13566	13325	13325
query23	17286	16413	16142	16142
query23_1	16202	16180	16172	16172
query24	7646	1751	1316	1316
query24_1	1317	1306	1277	1277
query25	578	463	406	406
query26	1431	391	215	215
query27	2732	565	370	370
query28	4445	2001	1984	1984
query29	1071	629	493	493
query30	343	272	231	231
query31	1120	1092	984	984
query32	105	66	67	66
query33	541	323	265	265
query34	1186	1129	627	627
query35	768	780	676	676
query36	1192	1187	1073	1073
query37	149	111	92	92
query38	1869	1703	1660	1660
query39	873	898	857	857
query39_1	833	826	825	825
query40	250	212	145	145
query41	64	62	63	62
query42	93	96	89	89
query43	318	331	282	282
query44	1437	785	760	760
query45	188	183	173	173
query46	1030	1212	734	734
query47	2118	2135	2015	2015
query48	397	402	288	288
query49	572	413	302	302
query50	1078	431	332	332
query51	10810	10807	10645	10645
query52	84	86	74	74
query53	257	271	195	195
query54	272	222	214	214
query55	73	71	64	64
query56	301	284	293	284
query57	1328	1275	1225	1225
query58	265	253	248	248
query59	1617	1710	1456	1456
query60	312	264	253	253
query61	144	148	149	148
query62	550	498	435	435
query63	237	197	191	191
query64	2807	1046	880	880
query65	4707	4630	4592	4592
query66	1836	499	371	371
query67	29180	29127	29006	29006
query68	3096	1482	934	934
query69	412	299	265	265
query70	1050	948	961	948
query71	361	337	309	309
query72	3067	2642	2366	2366
query73	797	773	405	405
query74	5060	4917	4744	4744
query75	2519	2500	2123	2123
query76	2328	1185	820	820
query77	349	380	274	274
query78	11847	11800	11198	11198
query79	1380	1153	768	768
query80	1326	532	468	468
query81	575	333	283	283
query82	634	155	139	139
query83	358	317	294	294
query84	272	155	128	128
query85	957	596	510	510
query86	429	294	264	264
query87	1811	1824	1746	1746
query88	3751	2799	2754	2754
query89	443	380	332	332
query90	1954	198	196	196
query91	199	187	165	165
query92	63	57	59	57
query93	1683	1490	981	981
query94	726	321	306	306
query95	784	522	482	482
query96	1034	797	351	351
query97	2606	2624	2501	2501
query98	211	204	207	204
query99	1071	1115	976	976
Total cold run time: 263477 ms
Total hot run time: 176905 ms

@hello-stephen

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

query1	0.01	0.00	0.00
query2	0.09	0.04	0.05
query3	0.25	0.13	0.14
query4	1.61	0.14	0.13
query5	0.23	0.24	0.22
query6	1.24	1.08	1.07
query7	0.03	0.00	0.01
query8	0.06	0.04	0.04
query9	0.38	0.30	0.30
query10	0.54	0.55	0.55
query11	0.20	0.13	0.13
query12	0.17	0.13	0.15
query13	0.46	0.46	0.47
query14	1.01	1.01	0.99
query15	0.60	0.60	0.58
query16	0.30	0.33	0.33
query17	1.06	1.10	1.11
query18	0.22	0.21	0.21
query19	2.03	1.90	1.92
query20	0.02	0.02	0.01
query21	15.42	0.20	0.15
query22	4.96	0.05	0.05
query23	16.15	0.29	0.12
query24	2.97	0.39	0.32
query25	0.12	0.04	0.04
query26	0.72	0.20	0.14
query27	0.06	0.03	0.03
query28	3.50	0.94	0.54
query29	12.48	4.07	3.26
query30	0.28	0.17	0.16
query31	2.76	0.60	0.30
query32	3.21	0.59	0.48
query33	3.11	3.12	3.21
query34	15.50	4.21	3.52
query35	3.52	3.49	3.51
query36	0.54	0.43	0.44
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.16	0.16
query41	0.08	0.04	0.03
query42	0.04	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 96.32 s
Total hot run time: 24.84 s

@eldenmoon eldenmoon changed the title [fix](be) Prefer sparse variant fields over root value [fix](variant) Prefer sparse variant fields over root value Jul 22, 2026
@hello-stephen

Copy link
Copy Markdown
Contributor

branch-4.1 full regression build 203698 reproduced DORIS-27147 with 672 olap_scan_limit_pushdown_complex_types.data_id_5500025 failures.

I prepared a focused follow-up for the two unresolved review threads: eldenmoon#5

It changes the doc-value guard to a current-row offset delta, adds the requested prior-doc/current-sparse unit scenario, and removes the two {} rows whose [] oracle would lock in unrelated corruption. git diff --check passes; the targeted BE UT did not reach compilation locally because the fresh macOS worktree was still cloning the large ORC third-party submodule, so CI is still required.

The existing macOS BE UT red on #65660 is unrelated runner setup (Java 25, project requires JDK 17), not a failure in the VARIANT patch.

@hello-stephen

Copy link
Copy Markdown
Contributor

Additional CI triage (2026-07-22): the existing red checks on revision ed4a264eb9f are environmental and predate the review follow-up.

  • BE UT build 997984 completed ColumnVariantTest successfully, then ASAN failed to reserve ~1 MiB of shadow memory while running TimeSharingTaskExecutorTest (errno: 12, ReserveShadowMemoryRange failed) and the container aborted. This is agent/address-space exhaustion, not a variant assertion failure.
  • macOS BE UT stopped during setup because the runner exposed Java 25 while this branch requires JDK 17.

The two unresolved review issues are addressed separately in eldenmoon#5. After that follow-up is merged into this PR head, please rerun BE UT/macOS BE UT on the new revision.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@eldenmoon

Copy link
Copy Markdown
Member Author

run p0

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 57.89% (24453/42242)
Line Coverage 41.92% (243493/580886)
Region Coverage 37.83% (193454/511420)
Branch Coverage 38.89% (86962/223628)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 74.92% (30438/40626)
Line Coverage 58.92% (334611/567886)
Region Coverage 55.63% (280489/504193)
Branch Coverage 56.75% (124014/218530)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 74.97% (30457/40626)
Line Coverage 58.95% (334766/567886)
Region Coverage 55.66% (280612/504193)
Branch Coverage 56.78% (124078/218530)

@eldenmoon

Copy link
Copy Markdown
Member Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@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 completed for PR 65660 at head ed4a264eb9fc7b47e2ee2db678c7c7742eee9fb0.

No new inline findings remain after validation and duplicate suppression. The PR is not ready to merge because two existing correctness threads remain unresolved:

  • discussion_r3587564814: cumulative doc-snapshot offsets can still route a later sparse row through an empty current-row doc branch.
  • discussion_r3587564816: the regression oracle records [] for pk 9 and pk 15 even though both rows insert {}.

Checkpoint conclusions:

  • Goal and proof: The added current-row sparse-offset check correctly prevents a non-array JSONB root from hiding sparse object fields, and the unit test exercises that representation. The end-to-end regression is not yet valid proof for all selected rows because its two empty-object expectations are wrong.
  • Scope and clarity: The implementation change is small, focused, and reuses the existing ColumnMap offset invariant.
  • Concurrency and lifecycle: The changed path is read-only serialization; it adds no locks, atomics, ownership transfers, static initialization, or lifecycle coupling.
  • Configuration and compatibility: No production configuration, persisted format, wire protocol, symbol, or rolling-upgrade contract changes. The regression uses session-only knobs to force V3 sparse layout and TopN materialization.
  • Parallel paths and conditions: Storage row scatter, Variant Block SerDe, TopN response merge, and result SerDes were traced. Persisted roots are Nullable(JSONB); sparse and doc readers default the unused representation. The row-0 nrow - 1 access is the documented PaddedPODArray sentinel convention.
  • Tests and results: The unit is targeted and the p0 query is deterministically ordered and asserts MaterializeNode, but the two bad expected rows and the missing prior-doc/current-sparse case must be corrected in the existing threads. Per the review-runner contract, I did not build or run tests locally.
  • Observability, transactions, persistence, and FE/BE variables: Not applicable to this local serialization predicate; no new gap found.
  • Performance: The change adds two O(1) offset reads with no allocation or copy after dense fields have been ruled out.
  • User focus: No additional user-provided focus was present.

Review coverage is complete for the current head; the two existing correctness issues still need fixes.

@eldenmoon
eldenmoon merged commit ec5f972 into apache:master Jul 23, 2026
36 of 37 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
A distributed ordered query using TopN lazy
materialization could return an array root such as [] instead of the
object fields stored in a VARIANT row. Root visibility already
considered dense subcolumns and document snapshots but ignored sparse
subcolumns, so a non-null root incorrectly won during serialization.
Check the current row sparse offsets before treating the root as
visible. Before the fix the reproduced row returned []; after the fix it
returns {"n":7,"word":"hot"}.
@hello-stephen

Copy link
Copy Markdown
Contributor

[review-followup-65957]

The separate review follow-up was not part of the merged head. It has now been cleanly reapplied to current master as #65957; further review, CI, and validation are tracked there.

yiguolei pushed a commit that referenced this pull request Jul 24, 2026
#65660 (#65950)

Cherry-picked from #65660

---------

Co-authored-by: lihangyu <lihangyu@selectdb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.1.4-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants