Skip to content

[refactor](storage) drop StorageField wrapper and clean up related dead code - #63233

Merged
airborne12 merged 3 commits into
apache:masterfrom
csun5285:refactor/drop-storagefield-wrapper
May 21, 2026
Merged

[refactor](storage) drop StorageField wrapper and clean up related dead code#63233
airborne12 merged 3 commits into
apache:masterfrom
csun5285:refactor/drop-storagefield-wrapper

Conversation

@csun5285

@csun5285csun5285 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Drop the StorageField wrapper and related dead code. StorageField was a thin layer over TabletColumn — every accessor just forwarded, all 11 subclasses were empty stubs with no caller distinguishing them via
dynamic_cast/typeid. After removing it, several dead pieces fell out.

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

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
  • 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

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

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

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29579 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit c322ef733f915fa262c959cac119947984d1a3de, data reload: false
------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	17645	3852	3839	3839
q2	q3	10718	900	618	618
q4	4663	456	351	351
q5	7465	1331	1139	1139
q6	183	167	140	140
q7	944	943	745	745
q8	9316	1428	1301	1301
q9	5552	5393	5331	5331
q10	6268	2093	1834	1834
q11	482	268	259	259
q12	633	414	292	292
q13	18081	3283	2771	2771
q14	295	285	260	260
q15	q16	900	877	791	791
q17	1011	1089	777	777
q18	6475	5695	5664	5664
q19	1150	1261	1034	1034
q20	502	407	263	263
q21	4553	2277	1868	1868
q22	421	357	302	302
Total cold run time: 97257 ms
Total hot run time: 29579 ms
----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	4165	4083	4094	4083
q2	q3	4652	4768	4205	4205
q4	2072	2165	1373	1373
q5	4996	5017	5256	5017
q6	183	165	130	130
q7	2071	1765	1793	1765
q8	3632	3234	3294	3234
q9	8612	8546	8571	8546
q10	4498	4498	4230	4230
q11	616	428	416	416
q12	702	753	509	509
q13	3542	3633	2906	2906
q14	310	314	289	289
q15	q16	792	789	681	681
q17	1362	1323	1283	1283
q18	8013	7119	7123	7119
q19	1170	1146	1139	1139
q20	2209	2230	1955	1955
q21	6226	5427	4922	4922
q22	540	527	425	425
Total cold run time: 60363 ms
Total hot run time: 54227 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 172234 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 c322ef733f915fa262c959cac119947984d1a3de, data reload: false
query5	4306	683	540	540
query6	324	225	201	201
query7	4227	580	319	319
query8	328	238	218	218
query9	8843	4062	4061	4061
query10	452	353	289	289
query11	5776	2448	2284	2284
query12	184	132	129	129
query13	1279	624	474	474
query14	6583	5366	5089	5089
query14_1	4329	4336	4305	4305
query15	206	200	183	183
query16	997	468	434	434
query17	1133	759	630	630
query18	2763	519	360	360
query19	218	206	158	158
query20	137	131	137	131
query21	229	135	112	112
query22	13643	13605	13509	13509
query23	17377	16335	16700	16335
query23_1	16331	16321	16304	16304
query24	7537	1843	1428	1428
query24_1	1456	1417	1407	1407
query25	598	571	486	486
query26	1452	340	184	184
query27	2875	622	344	344
query28	4339	1970	1972	1970
query29	1047	654	543	543
query30	316	257	208	208
query31	1112	1081	952	952
query32	91	75	74	74
query33	579	369	313	313
query34	1184	1155	646	646
query35	796	789	688	688
query36	1334	1286	1203	1203
query37	152	115	92	92
query38	3228	3144	3074	3074
query39	932	943	910	910
query39_1	876	877	860	860
query40	234	161	144	144
query41	71	68	69	68
query42	113	110	110	110
query43	326	332	284	284
query44 query45	212	205	249	205
query46	1048	1231	741	741
query47	2287	2288	2166	2166
query48	392	424	293	293
query49	632	545	444	444
query50	682	282	216	216
query51	4405	4349	4225	4225
query52	105	105	91	91
query53	257	272	201	201
query54	319	272	263	263
query55	93	89	83	83
query56	299	308	313	308
query57	1400	1378	1318	1318
query58	298	255	262	255
query59	1609	1678	1426	1426
query60	364	326	321	321
query61	175	165	162	162
query62	668	623	564	564
query63	241	198	200	198
query64	2327	836	708	708
query65 query66	1700	504	397	397
query67	30497	29729	30300	29729
query68 query69	465	347	299	299
query70	1036	1000	995	995
query71	305	276	269	269
query72	3015	2774	2427	2427
query73	851	776	433	433
query74	5091	4913	4760	4760
query75	2810	2725	2356	2356
query76	2310	1158	751	751
query77	449	430	341	341
query78	13308	13308	12538	12538
query79	1524	978	739	739
query80	1376	555	503	503
query81	510	294	256	256
query82	1280	154	117	117
query83	348	283	258	258
query84	259	134	109	109
query85	924	516	441	441
query86	444	352	308	308
query87	3468	3403	3222	3222
query88	3547	2701	2654	2654
query89	434	371	333	333
query90	1898	183	179	179
query91	179	171	140	140
query92	79	71	72	71
query93	956	964	571	571
query94	724	340	313	313
query95	672	459	360	360
query96	999	808	318	318
query97	2738	2689	2528	2528
query98	241	235	227	227
query99	1110	1114	985	985
Total cold run time: 256525 ms
Total hot run time: 172234 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 67.88% (112/165) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.60% (20589/38412)
Line Coverage37.18% (194795/523906)
Region Coverage33.59% (152469/453864)
Branch Coverage34.58% (66440/192137)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 85.98% (141/164) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.81% (27766/37619)
Line Coverage57.64% (301226/522565)
Region Coverage54.93% (251797/458397)
Branch Coverage56.39% (108775/192891)

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29501 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit dba29514cf661aeb26b3d7da818211a793307cac, data reload: false
------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	17670	3908	3869	3869
q2	q3	10718	885	610	610
q4	4659	462	339	339
q5	7461	1335	1136	1136
q6	191	166	141	141
q7	915	932	740	740
q8	9325	1372	1307	1307
q9	5633	5443	5337	5337
q10	6250	2100	1839	1839
q11	456	261	261	261
q12	631	415	295	295
q13	18180	3272	2779	2779
q14	292	285	264	264
q15	q16	903	859	786	786
q17	954	1017	715	715
q18	6512	5782	5408	5408
q19	1156	1248	1106	1106
q20	504	392	257	257
q21	4644	2384	1986	1986
q22	481	448	326	326
Total cold run time: 97535 ms
Total hot run time: 29501 ms
----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	4789	4710	4746	4710
q2	q3	4666	4821	4214	4214
q4	2130	2192	1446	1446
q5	5008	5000	5360	5000
q6	200	182	137	137
q7	2095	1783	1616	1616
q8	3310	3078	3083	3078
q9	8518	8420	8395	8395
q10	4475	4489	4241	4241
q11	612	414	397	397
q12	699	745	513	513
q13	3212	3616	2960	2960
q14	310	294	280	280
q15	q16	963	805	702	702
q17	1362	1311	1284	1284
q18	8033	7254	7160	7160
q19	1170	1138	1206	1138
q20	2216	2214	1936	1936
q21	6143	5460	4854	4854
q22	556	512	439	439
Total cold run time: 60467 ms
Total hot run time: 54500 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 171293 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 dba29514cf661aeb26b3d7da818211a793307cac, data reload: false
query5	4317	667	508	508
query6	330	223	204	204
query7	4368	597	303	303
query8	329	226	221	221
query9	8823	4041	4032	4032
query10	461	342	305	305
query11	5794	2382	2226	2226
query12	186	130	127	127
query13	1344	621	443	443
query14	6692	5361	5072	5072
query14_1	4383	4444	4334	4334
query15	219	205	190	190
query16	1020	431	450	431
query17	1307	761	644	644
query18	2709	491	346	346
query19	248	198	153	153
query20	136	129	122	122
query21	214	135	118	118
query22	13533	14101	14519	14101
query23	17328	16550	16229	16229
query23_1	16305	16279	16229	16229
query24	7414	1746	1330	1330
query24_1	1336	1348	1366	1348
query25	540	477	424	424
query26	1278	301	168	168
query27	2674	588	339	339
query28	4388	1946	1919	1919
query29	987	669	530	530
query30	307	233	197	197
query31	1118	1065	942	942
query32	86	74	74	74
query33	550	361	316	316
query34	1159	1135	635	635
query35	769	797	673	673
query36	1360	1305	1125	1125
query37	152	106	91	91
query38	3183	3136	3085	3085
query39	925	918	887	887
query39_1	889	876	866	866
query40	236	159	139	139
query41	70	68	66	66
query42	109	110	107	107
query43	318	338	278	278
query44 query45	210	201	191	191
query46	1045	1221	765	765
query47	2284	2350	2176	2176
query48	411	429	294	294
query49	656	559	438	438
query50	724	280	235	235
query51	4341	4308	4185	4185
query52	107	106	92	92
query53	257	277	204	204
query54	335	285	266	266
query55	96	93	87	87
query56	321	318	308	308
query57	1430	1380	1298	1298
query58	308	287	276	276
query59	1570	1626	1410	1410
query60	399	334	319	319
query61	162	155	185	155
query62	668	619	559	559
query63	236	195	204	195
query64	2328	815	669	669
query65 query66	1714	501	398	398
query67	30085	29870	29257	29257
query68 query69	467	340	300	300
query70	1012	983	991	983
query71	308	260	267	260
query72	2995	2716	2460	2460
query73	808	775	414	414
query74	5102	4881	4696	4696
query75	2792	2650	2320	2320
query76	2276	1152	727	727
query77	413	417	343	343
query78	12980	12967	12343	12343
query79	1497	1025	763	763
query80	1376	555	469	469
query81	500	283	239	239
query82	1248	155	123	123
query83	359	277	250	250
query84	256	144	114	114
query85	915	517	465	465
query86	441	336	304	304
query87	3402	3333	3214	3214
query88	3566	2676	2672	2672
query89	435	379	332	332
query90	1911	181	177	177
query91	177	165	142	142
query92	75	75	71	71
query93	952	953	572	572
query94	719	338	297	297
query95	675	479	351	351
query96	1010	788	368	368
query97	2675	2678	2580	2580
query98	233	228	226	226
query99	1110	1121	993	993
Total cold run time: 255233 ms
Total hot run time: 171293 ms

@csun5285csun5285 changed the title [refactor](storage) drop StorageField wrapper and others dead code[refactor](storage) drop StorageField wrapper and clean up related dead codeMay 14, 2026
@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 69.19% (119/172) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.64% (20603/38413)
Line Coverage37.21% (194930/523904)
Region Coverage33.61% (152566/453867)
Branch Coverage34.60% (66485/192139)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 91.23% (156/171) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.77% (27752/37619)
Line Coverage57.61% (301012/522530)
Region Coverage54.94% (251796/458291)
Branch Coverage56.40% (108782/192867)

@csun5285
csun5285force-pushed the refactor/drop-storagefield-wrapper branch from dba2951 to 2a6bd48CompareMay 15, 2026 03:14
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29501 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 2a6bd48455b629e25dd2b406e79f413994320d94, data reload: false
------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	17659	3825	3840	3825
q2	q3	10700	894	596	596
q4	4682	451	348	348
q5	7450	1348	1141	1141
q6	185	165	137	137
q7	920	962	745	745
q8	9310	1445	1274	1274
q9	5586	5369	5328	5328
q10	6262	2088	1790	1790
q11	465	266	258	258
q12	628	429	288	288
q13	18066	3303	2780	2780
q14	286	289	260	260
q15	q16	906	885	800	800
q17	929	947	755	755
q18	6539	5729	5609	5609
q19	1170	1256	1103	1103
q20	525	389	264	264
q21	4822	2283	1889	1889
q22	430	352	311	311
Total cold run time: 97520 ms
Total hot run time: 29501 ms
----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	4150	4116	4112	4112
q2	q3	4639	4752	4178	4178
q4	2102	2163	1369	1369
q5	4961	4962	5237	4962
q6	188	163	128	128
q7	2021	1763	1759	1759
q8	3626	3200	3287	3200
q9	8459	8525	8531	8525
q10	4516	4494	4238	4238
q11	611	434	389	389
q12	699	768	499	499
q13	3572	3585	2938	2938
q14	294	309	288	288
q15	q16	780	796	678	678
q17	1334	1306	1254	1254
q18	8051	7085	7081	7081
q19	1148	1155	1179	1155
q20	2205	2225	1954	1954
q21	6195	5410	4869	4869
q22	567	514	446	446
Total cold run time: 60118 ms
Total hot run time: 54022 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 170724 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 2a6bd48455b629e25dd2b406e79f413994320d94, data reload: false
query5	4346	638	519	519
query6	315	225	193	193
query7	4248	570	304	304
query8	321	241	213	213
query9	8836	3976	3952	3952
query10	447	336	297	297
query11	5805	2396	2217	2217
query12	180	125	122	122
query13	1271	602	437	437
query14	6031	5318	5013	5013
query14_1	4312	4357	4346	4346
query15	208	198	182	182
query16	985	444	442	442
query17	1117	734	612	612
query18	2435	468	350	350
query19	209	196	154	154
query20	133	127	130	127
query21	212	135	113	113
query22	13625	13383	13327	13327
query23	17233	16255	16707	16255
query23_1	16419	16292	16287	16287
query24	7651	1815	1389	1389
query24_1	1426	1444	1413	1413
query25	595	495	436	436
query26	1398	313	160	160
query27	2727	578	325	325
query28	4422	1959	1971	1959
query29	965	621	509	509
query30	297	229	191	191
query31	1122	1063	946	946
query32	85	68	66	66
query33	522	334	284	284
query34	1188	1133	657	657
query35	738	770	678	678
query36	1346	1319	1198	1198
query37	147	101	84	84
query38	3183	3086	3046	3046
query39	927	917	890	890
query39_1	878	881	871	871
query40	229	150	137	137
query41	64	59	61	59
query42	106	103	113	103
query43	314	326	277	277
query44 query45	207	201	188	188
query46	1050	1166	719	719
query47	2361	2274	2160	2160
query48	379	432	302	302
query49	626	522	413	413
query50	715	278	213	213
query51	4312	4248	4259	4248
query52	105	101	90	90
query53	250	275	197	197
query54	302	270	248	248
query55	90	87	83	83
query56	284	306	301	301
query57	1430	1408	1305	1305
query58	290	259	265	259
query59	1553	1630	1383	1383
query60	353	319	313	313
query61	164	159	185	159
query62	675	622	572	572
query63	241	206	203	203
query64	2497	866	716	716
query65 query66	1758	522	409	409
query67	30033	30043	29875	29875
query68 query69	471	348	313	313
query70	1020	989	946	946
query71	310	287	264	264
query72	3170	3134	2539	2539
query73	809	778	419	419
query74	5088	4887	4692	4692
query75	2764	2665	2296	2296
query76	2298	1132	780	780
query77	409	420	353	353
query78	12958	13021	12346	12346
query79	1469	995	728	728
query80	1367	568	482	482
query81	519	282	236	236
query82	1291	158	123	123
query83	353	274	253	253
query84	264	136	107	107
query85	944	512	452	452
query86	463	335	315	315
query87	3395	3337	3212	3212
query88	3551	2693	2682	2682
query89	432	373	333	333
query90	1894	177	177	177
query91	178	169	146	146
query92	77	77	72	72
query93	942	954	562	562
query94	704	326	306	306
query95	669	473	339	339
query96	1007	766	336	336
query97	2708	2689	2554	2554
query98	231	227	247	227
query99	1187	1127	982	982
Total cold run time: 254573 ms
Total hot run time: 170724 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 69.19% (119/172) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage53.53% (20604/38494)
Line Coverage37.15% (194950/524720)
Region Coverage33.53% (152590/455134)
Branch Coverage34.54% (66491/192497)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 88.30% (151/171) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.92% (27114/37700)
Line Coverage55.21% (288939/523352)
Region Coverage52.13% (239588/459559)
Branch Coverage53.51% (103391/193227)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 88.30% (151/171) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.92% (27114/37700)
Line Coverage55.21% (288946/523352)
Region Coverage52.17% (239773/459559)
Branch Coverage53.51% (103400/193227)

airborne12
airborne12 previously approved these changes May 17, 2026

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label May 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@airborne12

Copy link
Copy Markdown
Member

/review

@github-actionsgithub-actionsBot 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. I did not find any blocking correctness issues in this refactor.

Critical checkpoint conclusions:

  • Goal/test proof: The PR removes StorageField and routes storage/index/schema code through TabletColumn directly. The changed call sites appear to preserve the previous forwarded metadata semantics. Existing BE UT coverage is claimed by the PR; I did not rerun the full suite in this review runner.
  • Scope/focus: The change is broad but mechanically focused on replacing the wrapper and deleting now-unused value wrappers/tests.
  • Concurrency/lifecycle: No new concurrent state or lock ordering changes were introduced. Ownership changes from raw StorageField pointers to TabletColumnPtr/shared copies appear lifetime-safe for the reviewed writer/schema/iterator paths.
  • Config/compatibility/protocol: No new config, persisted format, thrift, or FE-BE protocol changes found. Column metadata written to segment/index footers remains derived from TabletColumn/ColumnMetaPB as before.
  • Parallel paths: Segment writing, index building, zone map, inverted index, ANN, row cursor, variant writer, and tests were updated consistently; no remaining live StorageField/CollectionValue references were found outside stale comments.
  • Error handling: Existing Status propagation is preserved in the changed paths; no newly ignored Status found.
  • Data correctness: Key encoding, index writer creation, and cell-size pointer stepping use the same field_type_size/KeyCoder semantics StorageField previously forwarded. Complex container writers avoid direct container cell-size stepping.
  • Performance/memory: Removal of wrapper allocations is neutral-to-positive; no obvious new hot-path redundant work beyond a KeyCoder lookup in RowCursor noted by the PR as non-hot.
  • Observability: No new observability need for this internal refactor.
  • User focus: No additional user-provided review focus was supplied.

Residual risk: I did not run the full BE build/UT suite here, so compile/test confidence depends on CI and the author-reported BE UT run.

Comment threadbe/benchmark/benchmark_zone_map_index.hpp
Comment threadbe/src/storage/segment/column_writer.cpp
yiguolei
yiguolei previously approved these changes May 20, 2026
csun5285and others added 3 commits May 20, 2026 13:46
StorageField was a thin wrapper over TabletColumn that cached a KeyCoder*
pointer and pre-resolved an owned tree of sub-fields. Aside from those two
extras, every accessor (type/length/name/is_nullable/unique_id/...) was a
direct forward to the underlying TabletColumn it held a copy of, and all 11
subclasses (CharField/VarcharField/.../HllAggField) were empty stubs with
zero callers distinguishing them (no dynamic_cast/typeid/static_cast).
Replace StorageField with TabletColumn throughout the storage layer:
- Schema now stores vector<TabletColumnPtr> instead of vector<StorageField*>,
so copy/dtor are handled by shared_ptr ref counting; the deep-copy clone()
path is gone.
- ColumnWriter family takes TabletColumnPtr (owned by writer) instead of
unique_ptr<StorageField>; get_field()/_field renamed to get_column()/_column.
- IndexColumnWriter::create and ZoneMapIndexWriter::create take
const TabletColumn* directly.
- DataTypeFactory drops the StorageField overload (kept the existing
TabletColumn one).
- Five row_cursor.cpp encode sites switch to free helpers
(get_key_coder(type)->...), the only consumers of StorageField's
_key_coder cache. Per-call switch overhead is negligible since this is
not a hot path; production hot paths (vertical/segment_writer,
indexed_column_*) already cache KeyCoder locally without going through
StorageField.
- _has_char_type, _init_column_mapping, index_builder, variant_*, and
segment_iterator switch to TabletColumn::get_sub_column/get_subtype_count
in place of StorageField::get_sub_field/get_sub_field_count.
- Rename row_cursor's _encode_field to _encode_column_value and
column_schema(cid) to column(cid) to match the new semantics; rename
local null_field/bigint_field to null_column_ptr/length_column_ptr.
Net effect: -434 lines (field.h removed plus dead 11-subclass hierarchy),
no behavioral change. BE UT (302 tests across tablet_schema, storage_types,
KeyCoder, InvertedIndex, BkdIndex, ColumnWriter, ZoneMap, RowCursor) all
pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rs + minor cleanup
Follow-up to "drop StorageField wrapper". Three small refactors:
1. ColumnWriter::cell_size() helper
Replace 7 occurrences of `field_type_size(get_column()->type())` in
ColumnWriter::append_nullable / ScalarColumnWriter::append_* with a single
inline cell_size() method on the base class. Pure DRY, no behavior change.
2. VariantWriter ctors: drop redundant raw `column` param
VariantDocCompactWriter / VariantSubcolumnWriter / VariantColumnWriter
previously took both `(const TabletColumn* column, TabletColumnPtr owned_column)`
where the call site always passed the same column in both positions:
std::make_unique<VariantDocCompactWriter>(
opts, column, std::make_shared<TabletColumn>(*column));
The raw `column` was stored as `_tablet_column` for direct getter access, but
the same pointer is available via the base class's `get_column()` (returning
`_column.get()`). Collapse to a single `TabletColumnPtr column` param and drop
the redundant `_tablet_column` member from both ColumnWriter subclasses; rewrite
their 6 method-body usages to call `get_column()`.
VariantColumnWriterImpl is the pimpl impl of VariantColumnWriter and is NOT a
ColumnWriter subclass, so it keeps its own `_tablet_column` member; the outer
VariantColumnWriter ctor now passes `get_column()` to the impl ctor.
Semantic change: the raw pointer formerly pointed to the caller's original
TabletColumn; now it points to the base class's owned copy (made via
`std::make_shared<TabletColumn>(*column)` at the call site). Lifetime-safe and
content-equivalent for read-only access.
3. olap_common.h: update stale comments
- FieldType enum: drop the dangling "Field" reference (StorageField was
removed by the parent commit, doris::Field is unrelated here).
- FieldAggregationMethod enum: restore the previous verbose comment style
with the class name updated to TabletColumn.
…k / disabled test
Follow-up to the previous two commits. Two latent breakages where code that
doesn't ride the default build path still referenced classes deleted by this
PR series:
1) be/benchmark/benchmark_zone_map_index.hpp
`benchmark_test` (built only with `--benchmark`, default OFF) was wiring up
its zone-map writer through the now-deleted `StorageFieldFactory::create`.
Drop the wrapper and pass the `TabletColumn*` straight into
`ZoneMapIndexWriter::create`, which is what the writer wants anyway after
the previous commit's API change. Verified by RELEASE build of the
`benchmark_test` target: our hpp compiles cleanly (the binary as a whole
still fails on `binary_cast_benchmark.hpp`, but that is fallout from PR
apache#53135 union-to-`std::bit_cast` migration and is out of scope here).
2) be/test/storage/segment/column_reader_writer_test.cpp
This file is in the `# todo: need fix those ut` REMOVE_ITEM list of
be/test/CMakeLists.txt and is not built. It was already broken on the
deleted row-based `ColumnBlock` / `ColumnVectorBatch` API from a prior BE
refactor; this PR series additionally killed `StorageField` and
`CollectionValue` it referenced. Strip out the four pieces tied to the
classes this PR deleted, leaving the rest of the file as-is for whoever
eventually revives the legacy `ColumnBlock` paths:
- the `test_array_nullable_data` helper (used CollectionValue +
StorageFieldFactory)
- TEST_F(test_array_type) (only caller of that helper)
- TEST_F(test_single_empty_array) (constructed CollectionValue)
- TEST_F(test_mixed_empty_arrays) (same)
The file stays in REMOVE_ITEM so the build state is unchanged.
@csun5285
csun5285 dismissed stale reviews from yiguolei and airborne12 via c379e58May 20, 2026 05:49
@csun5285
csun5285force-pushed the refactor/drop-storagefield-wrapper branch from 2a6bd48 to c379e58CompareMay 20, 2026 05:49
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@github-actionsgithub-actionsBot removed the approved Indicates a PR has been approved by one committer. label May 20, 2026
@yiguolei

Copy link
Copy Markdown
Contributor

/review

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 31562 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit c379e58a90c9554f934a78072d0e3299cde27ae6, data reload: false
------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	17832	3960	3828	3828
q2	q3	10742	1493	845	845
q4	4684	483	342	342
q5	7734	2332	2196	2196
q6	238	184	139	139
q7	979	800	645	645
q8	9429	1808	1561	1561
q9	5137	4926	4893	4893
q10	6384	2100	1796	1796
q11	448	275	240	240
q12	634	445	296	296
q13	18148	3408	2801	2801
q14	258	258	240	240
q15	q16	822	778	713	713
q17	969	907	919	907
q18	6984	5770	5600	5600
q19	1154	1197	1137	1137
q20	671	454	310	310
q21	6257	2975	2733	2733
q22	478	527	340	340
Total cold run time: 99982 ms
Total hot run time: 31562 ms
----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL ============================================
q1	4625	4576	4567	4567
q2	q3	4855	5309	4577	4577
q4	2165	2227	1428	1428
q5	5014	4659	4655	4655
q6	239	181	133	133
q7	1912	1765	1539	1539
q8	2425	2138	2160	2138
q9	7653	7304	7228	7228
q10	4488	4401	3988	3988
q11	545	398	368	368
q12	714	728	513	513
q13	3041	3333	2826	2826
q14	268	274	243	243
q15	q16	686	700	621	621
q17	1284	1267	1252	1252
q18	7493	6961	6598	6598
q19	1142	1067	1138	1067
q20	2205	2244	1923	1923
q21	5418	4686	4505	4505
q22	529	464	415	415
Total cold run time: 56701 ms
Total hot run time: 50584 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 171520 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 c379e58a90c9554f934a78072d0e3299cde27ae6, data reload: false
query5	4372	673	536	536
query6	347	220	218	218
query7	4331	608	314	314
query8	337	245	228	228
query9	8849	4040	4026	4026
query10	450	347	313	313
query11	5807	2401	2213	2213
query12	181	131	132	131
query13	1276	629	421	421
query14	6048	5423	5108	5108
query14_1	4438	4401	4376	4376
query15	216	211	187	187
query16	1011	475	459	459
query17	1102	753	628	628
query18	2457	502	367	367
query19	226	210	186	186
query20	149	138	145	138
query21	221	147	129	129
query22	13633	13548	13470	13470
query23	17245	16376	16123	16123
query23_1	16116	16263	16174	16174
query24	7644	1792	1324	1324
query24_1	1337	1330	1333	1330
query25	585	505	454	454
query26	1307	337	183	183
query27	2687	572	348	348
query28	4488	1964	1994	1964
query29	1017	647	539	539
query30	314	239	206	206
query31	1119	1070	949	949
query32	98	79	79	79
query33	551	379	321	321
query34	1194	1140	650	650
query35	797	774	685	685
query36	1296	1270	1143	1143
query37	157	113	102	102
query38	3228	3157	3094	3094
query39	936	924	903	903
query39_1	862	881	853	853
query40	244	148	136	136
query41	70	67	65	65
query42	109	109	114	109
query43	325	335	296	296
query44 query45	212	205	197	197
query46	1101	1233	742	742
query47	2325	2272	2179	2179
query48	386	413	297	297
query49	651	503	397	397
query50	1030	361	261	261
query51	4353	4425	4223	4223
query52	105	105	97	97
query53	251	294	208	208
query54	309	277	255	255
query55	102	105	85	85
query56	310	324	300	300
query57	1402	1380	1277	1277
query58	316	286	273	273
query59	1556	1637	1449	1449
query60	338	340	321	321
query61	168	164	161	161
query62	677	631	566	566
query63	245	206	212	206
query64	2441	815	637	637
query65 query66	1749	485	358	358
query67	30254	30173	30168	30168
query68 query69	464	348	315	315
query70	1063	1029	1003	1003
query71	312	286	274	274
query72	3166	2734	2423	2423
query73	887	814	419	419
query74	5099	4945	4755	4755
query75	2685	2611	2391	2391
query76	2302	1150	809	809
query77	412	432	348	348
query78	12322	12191	11894	11894
query79	1492	1010	789	789
query80	993	570	481	481
query81	509	276	248	248
query82	1385	163	128	128
query83	372	281	252	252
query84	291	146	118	118
query85	936	568	469	469
query86	454	360	339	339
query87	3425	3388	3257	3257
query88	3595	2680	2670	2670
query89	446	395	336	336
query90	1831	190	192	190
query91	186	175	142	142
query92	82	83	77	77
query93	1498	1495	840	840
query94	633	360	308	308
query95	692	386	446	386
query96	1051	806	338	338
query97	2681	2695	2608	2608
query98	255	236	228	228
query99	1129	1087	967	967
Total cold run time: 254799 ms
Total hot run time: 171520 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 86.63% (149/172) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.69% (27875/37828)
Line Coverage57.60% (302633/525404)
Region Coverage54.82% (253518/462425)
Branch Coverage56.31% (109398/194275)

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label May 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@airborne12airborne12 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 8a8999c into apache:masterMay 21, 2026
34 of 35 checks passed
zhaorongsheng pushed a commit to zhaorongsheng/doris that referenced this pull request Jun 4, 2026
…ad code (apache#63233)
Drop the `StorageField` wrapper and related dead code. `StorageField`
was a thin layer over `TabletColumn` — every accessor just forwarded,
all 11 subclasses were empty stubs with no caller distinguishing them
via
dynamic_cast/typeid. After removing it, several dead pieces fell out.
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 16, 2026
…ad code (apache#63233)
Drop the `StorageField` wrapper and related dead code. `StorageField`
was a thin layer over `TabletColumn` — every accessor just forwarded,
all 11 subclasses were empty stubs with no caller distinguishing them
via
dynamic_cast/typeid. After removing it, several dead pieces fell out.
Issue Number: close #xxx
Related PR: #xxx
(cherry picked from commit 8a8999c)
yiguolei pushed a commit that referenced this pull request Jun 17, 2026
…anch-4.1 (#63153#63233#63622#63291#64341) (#64550)
pick from master #63153#63233#63622#63291#64341
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/4.1.3-mergedreviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@csun5285@hello-stephen@airborne12@yiguolei@gavinchou