Skip to content

[refactor](BE) split EncodingInfo defaults into 4 explicit maps - #63622

Merged
yiguolei merged 3 commits into
apache:masterfrom
csun5285:dev/encoding-info-refactor
May 29, 2026
Merged

[refactor](BE) split EncodingInfo defaults into 4 explicit maps#63622
yiguolei merged 3 commits into
apache:masterfrom
csun5285:dev/encoding-info-refactor

Conversation

@csun5285

@csun5285csun5285 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Replace the EncodingPreference + runtime hook machinery in EncodingInfoResolver with four explicit maps and four matching get methods:

  • _v2_default_map -> get_v2_default_encoding(type)
  • _v3_default_map -> get_v3_default_encoding(type)
  • _index_column_default_map -> get_index_column_encoding(type)
  • _encoding_map -> get(type, encoding, out)

No on-disk format change; the resolved encodings written into ColumnMetaPB match the pre-refactor outputs for both v2 and V3 tablets.

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

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

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 32287 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b1e1a5698074aa88e6fa9a12ab270e3d63b40a42, 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	17639	4217	4073	4073
q2	q3	10786	1456	844	844
q4	4692	484	347	347
q5	7594	2375	2200	2200
q6	263	187	144	144
q7	1027	783	655	655
q8	9389	1660	1620	1620
q9	5418	5069	4998	4998
q10	6408	2233	1890	1890
q11	440	273	255	255
q12	648	430	301	301
q13	18111	3408	2794	2794
q14	267	266	251	251
q15	q16	832	780	712	712
q17	984	960	1014	960
q18	7084	5764	5518	5518
q19	1303	1429	1243	1243
q20	598	427	291	291
q21	6229	2866	2868	2866
q22	465	379	325	325
Total cold run time: 100177 ms
Total hot run time: 32287 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	4970	4931	4916	4916
q2	q3	5088	5244	4691	4691
q4	2406	2253	1452	1452
q5	4989	4705	4828	4705
q6	239	188	138	138
q7	1903	1772	1581	1581
q8	2524	2175	2173	2173
q9	7506	7563	7471	7471
q10	4776	4757	4290	4290
q11	549	400	371	371
q12	752	749	553	553
q13	3121	3436	2826	2826
q14	270	287	257	257
q15	q16	677	709	609	609
q17	1327	1302	1300	1300
q18	7422	7056	6905	6905
q19	1152	1110	1094	1094
q20	2258	2211	1965	1965
q21	5420	4732	4609	4609
q22	541	484	421	421
Total cold run time: 57890 ms
Total hot run time: 52327 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 173107 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 b1e1a5698074aa88e6fa9a12ab270e3d63b40a42, data reload: false
query5	4329	672	523	523
query6	327	221	198	198
query7	4227	595	308	308
query8	327	262	226	226
query9	8850	4146	4125	4125
query10	443	346	303	303
query11	5794	2634	2226	2226
query12	181	128	126	126
query13	1300	675	430	430
query14	6249	5560	5265	5265
query14_1	4566	4547	4505	4505
query15	215	217	188	188
query16	1021	485	397	397
query17	1153	755	626	626
query18	2485	496	369	369
query19	222	218	174	174
query20	145	140	134	134
query21	219	140	124	124
query22	13681	13541	13513	13513
query23	17428	16539	16240	16240
query23_1	16329	16413	16508	16413
query24	7551	1818	1341	1341
query24_1	1321	1350	1361	1350
query25	561	472	426	426
query26	1350	324	182	182
query27	2723	593	342	342
query28	4513	2111	2025	2025
query29	984	628	510	510
query30	311	245	203	203
query31	1131	1085	971	971
query32	91	75	70	70
query33	540	352	296	296
query34	1204	1131	675	675
query35	787	806	697	697
query36	1416	1409	1243	1243
query37	156	113	94	94
query38	3216	3189	3086	3086
query39	955	929	922	922
query39_1	870	872	875	872
query40	226	165	127	127
query41	65	65	63	63
query42	111	110	110	110
query43	337	343	295	295
query44 query45	218	209	199	199
query46	1085	1245	766	766
query47	2416	2409	2278	2278
query48	411	416	317	317
query49	626	496	386	386
query50	972	357	249	249
query51	4361	4327	4414	4327
query52	107	105	96	96
query53	262	292	208	208
query54	319	277	257	257
query55	93	96	85	85
query56	317	298	321	298
query57	1432	1434	1331	1331
query58	300	279	275	275
query59	1626	1668	1398	1398
query60	320	318	315	315
query61	151	151	158	151
query62	692	656	578	578
query63	244	209	207	207
query64	2415	833	668	668
query65 query66	1734	489	364	364
query67	30221	29557	29974	29557
query68 query69	473	337	306	306
query70	1042	1024	1008	1008
query71	305	280	275	275
query72	3030	2772	2441	2441
query73	855	786	435	435
query74	5124	4959	4823	4823
query75	2708	2646	2293	2293
query76	2271	1184	780	780
query77	409	425	350	350
query78	12329	12517	11915	11915
query79	1282	1052	808	808
query80	591	546	454	454
query81	458	279	246	246
query82	238	157	121	121
query83	274	284	252	252
query84	267	144	114	114
query85	844	539	451	451
query86	366	335	349	335
query87	3406	3409	3277	3277
query88	3640	2789	2759	2759
query89	430	397	340	340
query90	2128	188	187	187
query91	179	167	139	139
query92	81	81	84	81
query93	1486	1392	838	838
query94	547	343	306	306
query95	698	472	377	377
query96	1056	834	358	358
query97	2734	2765	2645	2645
query98	241	230	228	228
query99	1201	1144	1023	1023
Total cold run time: 253938 ms
Total hot run time: 173107 ms

@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 31498 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit ebb96fc4a6ab398cc891b04c4acaa659e3a0f741, 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	17675	4108	4052	4052
q2	q3	10780	1402	822	822
q4	4684	482	341	341
q5	7559	2248	2128	2128
q6	312	176	141	141
q7	937	790	631	631
q8	9391	1754	1534	1534
q9	6822	4982	4954	4954
q10	6455	2241	1937	1937
q11	434	269	239	239
q12	689	429	299	299
q13	18190	3361	2780	2780
q14	266	259	233	233
q15	q16	831	794	709	709
q17	994	952	960	952
q18	6757	5721	5528	5528
q19	1179	1359	1084	1084
q20	530	453	272	272
q21	6163	2773	2540	2540
q22	450	376	322	322
Total cold run time: 101098 ms
Total hot run time: 31498 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	4845	4848	4946	4848
q2	q3	4882	5263	4851	4851
q4	2125	2222	1424	1424
q5	4996	4793	4670	4670
q6	228	183	141	141
q7	1871	1751	1565	1565
q8	2429	1986	1956	1956
q9	7548	7541	7430	7430
q10	4790	4722	4256	4256
q11	549	417	361	361
q12	736	743	544	544
q13	2966	3400	2795	2795
q14	279	285	252	252
q15	q16	685	710	626	626
q17	1295	1283	1277	1277
q18	7239	6834	6931	6834
q19	1160	1124	1085	1085
q20	2230	2237	1968	1968
q21	5327	4644	4472	4472
q22	527	462	408	408
Total cold run time: 56707 ms
Total hot run time: 51763 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 173081 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 ebb96fc4a6ab398cc891b04c4acaa659e3a0f741, data reload: false
query5	4312	659	527	527
query6	353	225	199	199
query7	4232	553	301	301
query8	324	260	227	227
query9	8844	4192	4145	4145
query10	446	350	306	306
query11	5709	2550	2182	2182
query12	181	130	123	123
query13	1282	606	448	448
query14	6214	5632	5317	5317
query14_1	4682	4681	4659	4659
query15	221	211	189	189
query16	1006	456	437	437
query17	1162	755	616	616
query18	2453	487	367	367
query19	227	214	185	185
query20	138	135	135	135
query21	218	143	120	120
query22	13799	13584	13434	13434
query23	17482	16550	16392	16392
query23_1	16324	16395	16400	16395
query24	7645	1761	1335	1335
query24_1	1337	1324	1321	1321
query25	570	477	426	426
query26	1288	327	170	170
query27	2687	574	363	363
query28	4478	2033	2049	2033
query29	1018	639	489	489
query30	319	249	206	206
query31	1133	1093	959	959
query32	101	77	75	75
query33	539	354	299	299
query34	1186	1146	677	677
query35	770	810	703	703
query36	1388	1406	1275	1275
query37	154	107	92	92
query38	3247	3233	3087	3087
query39	934	920	899	899
query39_1	875	887	894	887
query40	234	146	130	130
query41	67	65	64	64
query42	115	111	111	111
query43	351	352	311	311
query44 query45	223	209	199	199
query46	1131	1212	785	785
query47	2445	2411	2246	2246
query48	419	405	305	305
query49	638	508	425	425
query50	1123	354	249	249
query51	4438	4354	4318	4318
query52	108	108	95	95
query53	268	285	211	211
query54	309	282	282	282
query55	94	95	89	89
query56	307	314	313	313
query57	1481	1449	1400	1400
query58	311	288	272	272
query59	1692	1757	1537	1537
query60	322	329	322	322
query61	163	160	155	155
query62	708	641	585	585
query63	247	211	217	211
query64	2418	806	626	626
query65 query66	2240	483	368	368
query67	29892	29677	29458	29458
query68 query69	480	350	309	309
query70	1063	1012	1040	1012
query71	306	283	270	270
query72	3024	2644	2426	2426
query73	840	745	441	441
query74	5127	4952	4850	4850
query75	2695	2643	2265	2265
query76	2312	1134	783	783
query77	409	429	328	328
query78	12227	12367	11757	11757
query79	1268	1016	752	752
query80	559	544	461	461
query81	449	280	242	242
query82	246	158	125	125
query83	277	284	256	256
query84	267	141	113	113
query85	849	551	449	449
query86	360	368	360	360
query87	3393	3382	3260	3260
query88	3595	2737	2752	2737
query89	431	391	339	339
query90	2167	184	179	179
query91	178	165	138	138
query92	81	80	75	75
query93	1362	1353	917	917
query94	529	353	313	313
query95	685	398	439	398
query96	1074	793	372	372
query97	2741	2748	2592	2592
query98	236	231	230	230
query99	1168	1154	1027	1027
Total cold run time: 254509 ms
Total hot run time: 173081 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 92.74% (281/303) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.83% (28056/38001)
Line Coverage57.71% (304513/527640)
Region Coverage54.83% (254631/464427)
Branch Coverage56.39% (110048/195169)

Comment threadbe/src/storage/segment/vertical_segment_writer.cpp
Comment threadbe/src/storage/segment/segment_writer.cpp Outdated
Comment threadbe/src/storage/segment/encoding_info.h Outdated
Comment threadbe/src/storage/segment/encoding_info.cpp Outdated
Comment threadbe/src/storage/index/primary_key_index.cpp Outdated
Comment threadbe/src/storage/segment/encoding_info.h Outdated
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 31135 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 7e8f8df1fe781d0834691c41471270666298b9cb, 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	17718	3985	4012	3985
q2	q3	10774	1394	815	815
q4	4720	475	351	351
q5	8335	2287	2083	2083
q6	393	180	141	141
q7	954	763	652	652
q8	9384	1705	1595	1595
q9	7093	4999	4926	4926
q10	6488	2264	1884	1884
q11	450	275	242	242
q12	693	442	306	306
q13	18162	3465	2839	2839
q14	269	256	236	236
q15	q16	827	796	714	714
q17	968	906	988	906
q18	7024	5721	5493	5493
q19	1195	1263	989	989
q20	503	414	266	266
q21	5717	2558	2411	2411
q22	437	361	301	301
Total cold run time: 102104 ms
Total hot run time: 31135 ms
----- Round 2, with runtime_filter_mode=off -----
workload_group 0
============================================
show table status;
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
revenue0	View	NULL	NULL	-1	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:24	NULL	NULL	utf-8	NULL	NULL partsupp	Doris	NULL	NULL	80000000	56	4534120086	NULL	44625495	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:44:20	NULL	utf-8	NULL	NULL part	Doris	NULL	NULL	20000000	37	748811035	NULL	1935627	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:27:57	NULL	utf-8	NULL	NULL nation	Doris	NULL	NULL	25	138	3473	NULL	366	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:27:24	NULL	utf-8	NULL	NULL customer	Doris	NULL	NULL	15000000	92	1381653732	NULL	4374759	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:27:43	NULL	utf-8	NULL	NULL lineitem	Doris	NULL	NULL	600037902	33	19843441616	NULL	61784740	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:38:59	NULL	utf-8	NULL	NULL supplier	Doris	NULL	NULL	1000000	87	87519212	NULL	194931	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:27:25	NULL	utf-8	NULL	NULL region	Doris	NULL	NULL	5	240	1201	NULL	147	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:27:24	NULL	utf-8	NULL	NULL 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	4337	4260	4352	4260
q2	q3	4525	4883	4368	4368
q4	2114	2238	1399	1399
q5	4434	4325	4915	4325
q6	257	203	145	145
q7	1978	1859	1616	1616
q8	2782	2201	2239	2201
q9	8127	8040	8028	8028
q10	4837	4647	q11	q12	q13	q14	q15	q16	q17	q18	q19	q20	q21	q22	Total cold run time: 28554 ms
Total hot run time: 26342 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 76522 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 7e8f8df1fe781d0834691c41471270666298b9cb, data reload: false
query5	4313	672	512	512
query6	347	227	201	201
query7	4280	584	305	305
query8	328	237	221	221
query9	8849	4205	4178	4178
query10	452	336	297	297
query11	5815	2582	2265	2265
query12	172	129	126	126
query13	1272	633	457	457
query14	6179	5470	5175	5175
query14_1	4583	4514	4499	4499
query15	212	206	193	193
query16	1045	457	420	420
query17	1037	737	604	604
query18	2478	490	365	365
query19	238	195	165	165
query20	139	131	129	129
query21	211	137	115	115
query22	13737	13765	13394	13394
query23	17329	16793	16483	16483
query23_1	16564	16472	16610	16472
query24	7561	1833	1404	1404
query24_1	1435	1412	1379	1379
query25	595	517	434	434
query26	976	326	181	181
query27	3212 query28 query29 query30 query31 query32 query33 query34 query35 query36 query37 query38 query39 query39_1 query40 query41 query42 query43 query44 query45 query46 query47 query48 query49 query50 query51 query52 query53 query54 query55 query56 query57 query58 query59 query60 query61 query62 query63 query64 query65 query66 query67 query68 query69 query70 query71 query72 query73 query74 query75 query76 query77 query78 query79 query80 query81 query82 query83 query84 query85 query86 query87 query88 query89 query90 query91 query92 query93 query94 query95 query96 query97 query98 query99 Total cold run time: 133039 ms
Total hot run time: 76522 ms

@csun5285
csun5285force-pushed the dev/encoding-info-refactor branch from a91a4b5 to b5923d7CompareMay 27, 2026 01:09
@csun5285

Copy link
Copy Markdown
ContributorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 32014 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit b5923d7c486a43fa7db4d2f3e0845c93f01b59f3, 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	17768	4102	4084	4084
q2	q3	10787	1429	841	841
q4	4721	481	346	346
q5	7987	2324	2131	2131
q6	359	185	143	143
q7	964	799	653	653
q8	9375	1694	1726	1694
q9	7137	4993	4983	4983
q10	6474	2306	1887	1887
q11	447	276	255	255
q12	695	438	300	300
q13	18194	3509	2818	2818
q14	268	265	239	239
q15	q16	819	774	723	723
q17	897	961	1005	961
q18	7104	5844	5550	5550
q19	1286	1352	1167	1167
q20	533	408	277	277
q21	5898	2815	2644	2644
q22	471	376	318	318
Total cold run time: 102184 ms
Total hot run time: 32014 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	4857	4984	4795	4795
q2	q3	4911	5407	4687	4687
q4	2186	2237	1481	1481
q5	5027	4704	4795	4704
q6	246	196	142	142
q7	1925	1794	1607	1607
q8	2478	1973	2022	1973
q9	7528	7509	7490	7490
q10	4840	4731	4242	4242
q11	564	422	361	361
q12	746	757	566	566
q13	3021	3476	2821	2821
q14	281	292	259	259
q15	q16	699	703	628	628
q17	1329	1314	1297	1297
q18	7563	6789	6853	6789
q19	1207	1106	1155	1106
q20	2261	2256	1962	1962
q21	5437	4746	4584	4584
q22	555	493	425	425
Total cold run time: 57661 ms
Total hot run time: 51919 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 173506 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 b5923d7c486a43fa7db4d2f3e0845c93f01b59f3, data reload: false
query5	4327	669	518	518
query6	352	213	199	199
query7	4287	553	310	310
query8	325	237	217	217
query9	8852	4218	4160	4160
query10	479	339	301	301
query11	5802	2562	2219	2219
query12	190	129	127	127
query13	1264	613	432	432
query14	6261	5549	5256	5256
query14_1	4577	4576	4556	4556
query15	224	210	190	190
query16	1017	504	473	473
query17	1169	774	629	629
query18	2520	496	376	376
query19	227	212	179	179
query20	145	136	164	136
query21	216	138	121	121
query22	13731	13599	13368	13368
query23	17556	16731	16344	16344
query23_1	16351	16340	16396	16340
query24	7501	1777	1320	1320
query24_1	1326	1339	1337	1337
query25	564	464	412	412
query26	1323	333	172	172
query27	2669	564	349	349
query28	4442	2033	2083	2033
query29	983	638	503	503
query30	321	249	206	206
query31	1146	1075	948	948
query32	88	77	76	76
query33	546	367	303	303
query34	1192	1179	664	664
query35	783	795	712	712
query36	1428	1423	1220	1220
query37	156	107	93	93
query38	3216	3184	3004	3004
query39	939	960	902	902
query39_1	897	859	904	859
query40	243	149	132	132
query41	67	63	63	63
query42	111	113	111	111
query43	338	339	296	296
query44 query45	212	204	201	201
query46	1085	1254	720	720
query47	2373	2379	2261	2261
query48	388	415	298	298
query49	643	503	389	389
query50	1007	356	252	252
query51	4374	4320	4372	4320
query52	106	105	95	95
query53	258	293	207	207
query54	311	277	257	257
query55	96	91	89	89
query56	305	312	332	312
query57	1453	1451	1344	1344
query58	315	289	283	283
query59	1628	1752	1521	1521
query60	335	328	325	325
query61	182	179	180	179
query62	713	658	594	594
query63	250	206	214	206
query64	2483	857	703	703
query65 query66	1756	495	376	376
query67	29869	29860	29762	29762
query68 query69	482	350	322	322
query70	1051	1012	1027	1012
query71	313	276	316	276
query72	3112	2721	2429	2429
query73	835	760	453	453
query74	5153	4968	4843	4843
query75	2698	2630	2293	2293
query76	2313	1183	776	776
query77	411	419	342	342
query78	12651	12575	12033	12033
query79	1512	1079	754	754
query80	1273	548	466	466
query81	511	302	261	261
query82	1362	162	123	123
query83	361	277	252	252
query84	258	141	116	116
query85	952	536	462	462
query86	463	361	351	351
query87	3473	3394	3250	3250
query88	3663	2790	2784	2784
query89	462	401	342	342
query90	1806	188	183	183
query91	176	166	138	138
query92	82	77	75	75
query93	1471	1385	908	908
query94	670	363	311	311
query95	695	465	349	349
query96	1045	794	343	343
query97	2821	2746	2608	2608
query98	242	228	227	227
query99	1216	1165	1036	1036
Total cold run time: 256854 ms
Total hot run time: 173506 ms

Comment threadbe/src/storage/segment/encoding_info.cpp
Comment threadbe/src/storage/segment/encoding_info.cpp
Comment threadbe/src/storage/segment/encoding_info.cpp
Comment threadbe/src/storage/segment/encoding_info.cpp
@yiguolei

Copy link
Copy Markdown
Contributor

/review

github-actions[bot]
github-actionsBot previously requested changes May 27, 2026

@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 result: request changes.

Critical checkpoint conclusions:

  • Goal/test: the PR centralizes tablet storage format and encoding defaults for V2/V3 and adds/updates BE unit coverage, but one compatibility path is not proven safe.
  • Scope/clarity: the refactor is mostly focused around segment encoding defaults and tablet schema persistence.
  • Concurrency/lifecycle: no new shared mutable runtime state or locking path was found in the changed write/read paths; the static resolver remains the existing process-lifetime singleton pattern.
  • Configuration/dynamic behavior: no new dynamic config item is introduced.
  • Compatibility/storage format: blocking issue found. V3 tablet schema persistence now relies only on the newly added protobuf field in the non-cloud BE create path, which old BEs ignore during rolling upgrade/downgrade scenarios.
  • Parallel paths: cloud FE creation writes both the new field and old flags, but the BE non-cloud creation path no longer does; these paths are inconsistent.
  • Tests: tests cover the new resolver behavior, but I did not see coverage for mixed-version/legacy-proto compatibility of newly created V3 tablet schemas.
  • Observability/transactions/data writes: no additional observability issue found; the concern is schema metadata compatibility before any data-page correctness can be relied on.
  • User focus: no additional user-provided review focus was supplied.

Please keep the legacy V3 flags populated together with storage_format, or otherwise document/prove that old BEs cannot consume these tablet schema PBs during supported upgrade/rollback flows.

Comment threadbe/src/storage/tablet/tablet_meta.cpp
@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 3.17% (2/63) 🎉
Increment coverage report
Complete coverage report

@yiguolei

Copy link
Copy Markdown
Contributor

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

Automated review summary for PR 63622 at 8eff36a.

No additional blocking issues were found beyond the already-existing inline review threads. I did not duplicate those known comments.

Critical checkpoint conclusions:

  • Goal and tests: The PR centralizes tablet storage-format-driven encoding behavior and persists storage_format in tablet schema metadata. The modified BE unit/regression tests cover schema metadata conversion and encoding selection paths.
  • Scope/focus: The change is focused on storage format metadata, default encoding resolution, and related writer/reader plumbing.
  • Concurrency/lifecycle: No new shared mutable concurrency path or special lifecycle hazard was identified in the reviewed diff.
  • Configuration: No new dynamic config item is added; the behavior is driven by persisted tablet storage format.
  • Compatibility: The new storage_format field is converted in cloud/non-cloud schema PB paths, with legacy V3-flavor fields retained on V3 schema serialization for downgrade compatibility. Existing inline compatibility discussion was treated as known context.
  • Parallel paths: SegmentWriter, VerticalSegmentWriter, complex child writers, variant writers, indexed columns, and cloud PB conversion paths were checked for propagation.
  • Error handling/memory: No ignored Status or untracked large allocation issue was found in the changed code paths.
  • Data correctness: Encoding selection is resolved before writer init, and read-side PageIO predecode paths were checked for PLAIN_ENCODING_V2/dictionary handling.
  • Test results: I did not run builds or tests in this review pass.
  • Observability/performance: No required additional logging/metrics or obvious hot-path regression was identified.

User focus: No additional user-provided review focus was present.

@yiguolei
yiguolei merged commit 4f1dcdf into apache:masterMay 29, 2026
33 of 34 checks passed
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 1, 2026
…ta + lengths trailer
V3 layout: |data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|
Compared to V2 (length and data interleaved per entry), V3 lets the pre-decoder
memcpy the entire binary payload in a single shot and walk the contiguous
varuint length block once to fill the V1 offsets array, with no
data-pointer-vs-length-pointer dependency between the two passes.
This commit introduces PLAIN_ENCODING_V3 as a registered, available binary-plain
encoding; it does not change any default encoding. The on-disk format is a new
EncodingTypePB (= 9) and BinaryPlainEncodingTypePB (= 3), so existing V1/V2
segments keep dispatching to their own pre-decoders.
Wired into the (post-apache#63622) EncodingInfoResolver:
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> for the CppType and
Slice specializations, _register_supported_encoding<..., PLAIN_ENCODING_V3>()
for every binary type (CHAR/VARCHAR/STRING/JSONB/VARIANT/HLL/BITMAP/
QUANTILE_STATE/AGG_STATE), and a BinaryPlainPageV3PreDecoder hook in the
EncodingInfo constructor (Slice types only).
- gensrc protos: new EncodingTypePB and BinaryPlainEncodingTypePB enum values.
Note: the original change also flipped several V3 default encodings and the row
store column to V3 and edited segment_writer/vertical_segment_writer/
binary_dict_page/tablet_meta. Those paths were rewritten upstream by
apache#63622 (EncodingPreference -> explicit default maps), which now owns the V3
defaults; this rebase keeps those defaults unchanged and leaves PLAIN_ENCODING_V3
opt-in.
Tests: 15 BinaryPlainPageV3Test cases covering encode/decode roundtrip, seek,
read_by_rowids, empty page, page_full, large N, mixed lengths (including
unicode), reset, varint length boundaries (127/128/16383/16384 byte values
across 1/2/3-byte varint bands), raw trailer layout assertions, and two
corruption-rejection cases.
Benchmark (15-rep x 2s median, V3 / V2 speedup at 256 KiB page):
8B: 3.56x 16B: 3.07x 32B: 2.46x 64B: 2.63x
128B: 2.25x 256B: 1.39x 512B: 1.22x 1024B: 1.11x 4096B: 1.01x
V3 strictly does not lose to V2 across the tested grid.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 1, 2026
… segments
Introduce PLAIN_ENCODING_V3, a binary plain page whose on-disk layout is
|data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|.
Unlike V2 (length and data interleaved per entry), the contiguous layout lets the
pre-decoder memcpy the whole data block in one shot and walk the varint lengths once
to fill the V1 offsets array, with no data-vs-length pointer dependency between the
two passes.
V3 stores exactly the same bytes as V1/V2 — only the layout differs. In particular
CHAR keeps its trailing '\0' padding on disk (written by OlapColumnDataConvertorChar),
VARCHAR does not; the CHAR padding is stripped on read by BinaryPlainPageV3PreDecoder
<true>, mirroring PLAIN_ENCODING_V2.
Write/read wiring (post-apache#63622 EncodingInfoResolver):
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> (CppType + Slice),
_register_supported_encoding for every binary type, and the IS_CHAR-aware V3
pre-decoder dispatch in the EncodingInfo constructor.
- binary_plain_page_v3.h / binary_plain_page_v3_pre_decoder.h: builder and the
template<bool IS_CHAR> pre-decoder (CHAR strnlen-strips on read; non-CHAR takes the
single-memcpy fast path).
- gensrc protos: new EncodingTypePB (=9) and BinaryPlainEncodingTypePB (=3).
V3 segment defaults — every binary-plain default now uses the V3 layout:
- CHAR/VARCHAR/STRING/JSONB/VARIANT keep DICT_ENCODING, but the dictionary word page
(and the dict-overflow fallback plain page) use V3: ScalarColumnWriter::init sets
dict_binary_plain_encoding to V3, binary_dict_page.cpp maps it and dispatches the V3
inner encoding, and binary_dict_page_pre_decoder.h rewrites the inner V3 page to V1.
CHAR dictionary words are unpadded on read via the (CHAR, V3) IS_CHAR pre-decoder.
- HLL/BITMAP/QUANTILE_STATE/AGG_STATE -> PLAIN_ENCODING_V3 (_set_v3_default).
- the hidden row store column -> PLAIN_ENCODING_V3 (resolve_default_encoding).
Benchmarks (be/benchmark/benchmark_binary_plain_page_v2.hpp):
- V2 vs V3 pre-decode speed at fixed page sizes; V3 is faster for short/medium values
(~2.4-2.9x at <=64B) and never slower (1.0x at 4KB).
- V2 vs V3 on-disk size after ZSTD compression; same bytes, the V3 layout compresses
slightly better (smaller for short values).
- benchmark_main.cpp uses a custom main (DataPage allocation needs a ThreadContext +
mem tracker) and re-enables binary_cast_benchmark (it was wrongly disabled; the real
issue was include order, fixed by keeping our hpp last).
Tests: BinaryPlainPageV3Test (encode/decode/seek/read_by_rowids/empty/page_full/varint
boundaries/corruption, plus padded-CHAR round-trips that exercise the IS_CHAR read-side
strip), BinaryDictPageTest V3 round-trips (word page + dict-overflow fallback),
EncodingInfoTest defaults + pre-decoder dispatch, and column_meta_accessor / variant /
encoding_info expectation updates. All pass under ASAN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 1, 2026
… segments
Introduce PLAIN_ENCODING_V3, a binary plain page whose on-disk layout is
|data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|.
Unlike V2 (length and data interleaved per entry), the contiguous layout lets the
pre-decoder memcpy the whole data block in one shot and walk the varint lengths once
to fill the V1 offsets array, with no data-vs-length pointer dependency between the
two passes.
V3 stores exactly the same bytes as V1/V2 — only the layout differs. In particular
CHAR keeps its trailing '\0' padding on disk (written by OlapColumnDataConvertorChar),
VARCHAR does not; the CHAR padding is stripped on read by BinaryPlainPageV3PreDecoder
<true>, mirroring PLAIN_ENCODING_V2.
Write/read wiring (post-apache#63622 EncodingInfoResolver):
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> (CppType + Slice),
_register_supported_encoding for every binary type, and the IS_CHAR-aware V3
pre-decoder dispatch in the EncodingInfo constructor.
- binary_plain_page_v3.h / binary_plain_page_v3_pre_decoder.h: builder and the
template<bool IS_CHAR> pre-decoder (CHAR strnlen-strips on read; non-CHAR takes the
single-memcpy fast path).
- gensrc protos: new EncodingTypePB (=9) and BinaryPlainEncodingTypePB (=3).
V3 segment defaults — every binary-plain default now uses the V3 layout:
- CHAR/VARCHAR/STRING/JSONB/VARIANT keep DICT_ENCODING, but the dictionary word page
(and the dict-overflow fallback plain page) use V3: ScalarColumnWriter::init sets
dict_binary_plain_encoding to V3, binary_dict_page.cpp maps it and dispatches the V3
inner encoding, and binary_dict_page_pre_decoder.h rewrites the inner V3 page to V1.
CHAR dictionary words are unpadded on read via the (CHAR, V3) IS_CHAR pre-decoder.
- HLL/BITMAP/QUANTILE_STATE/AGG_STATE -> PLAIN_ENCODING_V3 (_set_v3_default).
- the hidden row store column -> PLAIN_ENCODING_V3 (resolve_default_encoding).
Benchmarks (be/benchmark/benchmark_binary_plain_page_v2.hpp):
- V2 vs V3 pre-decode speed at fixed page sizes; V3 is faster for short/medium values
(~2.4-2.9x at <=64B) and never slower (1.0x at 4KB).
- V2 vs V3 on-disk size after ZSTD compression; same bytes, the V3 layout compresses
slightly better (smaller for short values).
- benchmark_main.cpp uses a custom main (DataPage allocation needs a ThreadContext +
mem tracker) and re-enables binary_cast_benchmark (it was wrongly disabled; the real
issue was include order, fixed by keeping our hpp last).
Tests: BinaryPlainPageV3Test (encode/decode/seek/read_by_rowids/empty/page_full/varint
boundaries/corruption, plus padded-CHAR round-trips that exercise the IS_CHAR read-side
strip), BinaryDictPageTest V3 round-trips (word page + dict-overflow fallback),
EncodingInfoTest defaults + pre-decoder dispatch, and column_meta_accessor / variant /
encoding_info expectation updates. All pass under ASAN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 1, 2026
… segments
Introduce PLAIN_ENCODING_V3, a binary plain page whose on-disk layout is
|data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|.
Unlike V2 (length and data interleaved per entry), the contiguous layout lets the
pre-decoder memcpy the whole data block in one shot and walk the varint lengths once
to fill the V1 offsets array, with no data-vs-length pointer dependency between the
two passes.
V3 stores exactly the same bytes as V1/V2 — only the layout differs. In particular
CHAR keeps its trailing '\0' padding on disk (written by OlapColumnDataConvertorChar),
VARCHAR does not; the CHAR padding is stripped on read by BinaryPlainPageV3PreDecoder
<true>, mirroring PLAIN_ENCODING_V2.
Write/read wiring (post-apache#63622 EncodingInfoResolver):
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> (CppType + Slice),
_register_supported_encoding for every binary type, and the IS_CHAR-aware V3
pre-decoder dispatch in the EncodingInfo constructor.
- binary_plain_page_v3.h / binary_plain_page_v3_pre_decoder.h: builder and the
template<bool IS_CHAR> pre-decoder (CHAR strnlen-strips on read; non-CHAR takes the
single-memcpy fast path).
- gensrc protos: new EncodingTypePB (=9) and BinaryPlainEncodingTypePB (=3).
V3 segment defaults — every binary-plain default now uses the V3 layout:
- CHAR/VARCHAR/STRING/JSONB/VARIANT keep DICT_ENCODING, but the dictionary word page
(and the dict-overflow fallback plain page) use V3: ScalarColumnWriter::init sets
dict_binary_plain_encoding to V3, binary_dict_page.cpp maps it and dispatches the V3
inner encoding, and binary_dict_page_pre_decoder.h rewrites the inner V3 page to V1.
CHAR dictionary words are unpadded on read via the (CHAR, V3) IS_CHAR pre-decoder.
- HLL/BITMAP/QUANTILE_STATE/AGG_STATE -> PLAIN_ENCODING_V3 (_set_v3_default).
- the hidden row store column -> PLAIN_ENCODING_V3 (resolve_default_encoding).
Benchmarks (be/benchmark/benchmark_binary_plain_page_v2.hpp):
- V2 vs V3 pre-decode speed at fixed page sizes; V3 is faster for short/medium values
(~2.4-2.9x at <=64B) and never slower (1.0x at 4KB).
- V2 vs V3 on-disk size after ZSTD compression; same bytes, the V3 layout compresses
slightly better (smaller for short values).
- benchmark_main.cpp uses a custom main (DataPage allocation needs a ThreadContext +
mem tracker) and re-enables binary_cast_benchmark (it was wrongly disabled; the real
issue was include order, fixed by keeping our hpp last).
Tests: BinaryPlainPageV3Test (encode/decode/seek/read_by_rowids/empty/page_full/varint
boundaries/corruption, plus padded-CHAR round-trips that exercise the IS_CHAR read-side
strip), BinaryDictPageTest V3 round-trips (word page + dict-overflow fallback),
EncodingInfoTest defaults + pre-decoder dispatch, and column_meta_accessor / variant /
encoding_info expectation updates. All pass under ASAN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 1, 2026
… segments
Introduce PLAIN_ENCODING_V3, a binary plain page whose on-disk layout is
|data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|.
Unlike V2 (length and data interleaved per entry), the contiguous layout lets the
pre-decoder memcpy the whole data block in one shot and walk the varint lengths once
to fill the V1 offsets array, with no data-vs-length pointer dependency between the
two passes.
V3 stores exactly the same bytes as V1/V2 — only the layout differs. In particular
CHAR keeps its trailing '\0' padding on disk (written by OlapColumnDataConvertorChar),
VARCHAR does not; the CHAR padding is stripped on read by BinaryPlainPageV3PreDecoder
<true>, mirroring PLAIN_ENCODING_V2.
Write/read wiring (post-apache#63622 EncodingInfoResolver):
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> (CppType + Slice),
_register_supported_encoding for every binary type, and the IS_CHAR-aware V3
pre-decoder dispatch in the EncodingInfo constructor.
- binary_plain_page_v3.h / binary_plain_page_v3_pre_decoder.h: builder and the
template<bool IS_CHAR> pre-decoder (CHAR strnlen-strips on read; non-CHAR takes the
single-memcpy fast path).
- gensrc protos: new EncodingTypePB (=9) and BinaryPlainEncodingTypePB (=3).
V3 segment defaults — every binary-plain default now uses the V3 layout:
- CHAR/VARCHAR/STRING/JSONB/VARIANT keep DICT_ENCODING, but the dictionary word page
(and the dict-overflow fallback plain page) use V3: ScalarColumnWriter::init sets
dict_binary_plain_encoding to V3, binary_dict_page.cpp maps it and dispatches the V3
inner encoding, and binary_dict_page_pre_decoder.h rewrites the inner V3 page to V1.
CHAR dictionary words are unpadded on read via the (CHAR, V3) IS_CHAR pre-decoder.
- HLL/BITMAP/QUANTILE_STATE/AGG_STATE -> PLAIN_ENCODING_V3 (_set_v3_default).
- the hidden row store column -> PLAIN_ENCODING_V3 (resolve_default_encoding).
Benchmarks (be/benchmark/benchmark_binary_plain_page_v2.hpp):
- V2 vs V3 pre-decode speed at fixed page sizes; V3 is faster for short/medium values
(~2.4-2.9x at <=64B) and never slower (1.0x at 4KB).
- V2 vs V3 on-disk size after ZSTD compression; same bytes, the V3 layout compresses
slightly better (smaller for short values).
- benchmark_main.cpp uses a custom main (DataPage allocation needs a ThreadContext +
mem tracker) and re-enables binary_cast_benchmark (it was wrongly disabled; the real
issue was include order, fixed by keeping our hpp last).
Tests: BinaryPlainPageV3Test (encode/decode/seek/read_by_rowids/empty/page_full/varint
boundaries/corruption, plus padded-CHAR round-trips that exercise the IS_CHAR read-side
strip), BinaryDictPageTest V3 round-trips (word page + dict-overflow fallback),
EncodingInfoTest defaults + pre-decoder dispatch, and column_meta_accessor / variant /
encoding_info expectation updates. All pass under ASAN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 2, 2026
… segments
Introduce PLAIN_ENCODING_V3, a binary plain page whose on-disk layout is
|data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|.
Unlike V2 (length and data interleaved per entry), the contiguous layout lets the
pre-decoder memcpy the whole data block in one shot and walk the varint lengths once
to fill the V1 offsets array, with no data-vs-length pointer dependency between the
two passes.
V3 stores exactly the same bytes as V1/V2 — only the layout differs. In particular
CHAR keeps its trailing '\0' padding on disk (written by OlapColumnDataConvertorChar),
VARCHAR does not; the CHAR padding is stripped on read by BinaryPlainPageV3PreDecoder
<true>, mirroring PLAIN_ENCODING_V2.
Write/read wiring (post-apache#63622 EncodingInfoResolver):
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> (CppType + Slice),
_register_supported_encoding for every binary type, and the IS_CHAR-aware V3
pre-decoder dispatch in the EncodingInfo constructor.
- binary_plain_page_v3.h / binary_plain_page_v3_pre_decoder.h: builder and the
template<bool IS_CHAR> pre-decoder (CHAR strnlen-strips on read; non-CHAR takes the
single-memcpy fast path).
- gensrc protos: new EncodingTypePB (=9) and BinaryPlainEncodingTypePB (=3).
V3 segment defaults — every binary-plain default now uses the V3 layout:
- CHAR/VARCHAR/STRING/JSONB/VARIANT keep DICT_ENCODING, but the dictionary word page
(and the dict-overflow fallback plain page) use V3: ScalarColumnWriter::init sets
dict_binary_plain_encoding to V3, binary_dict_page.cpp maps it and dispatches the V3
inner encoding, and binary_dict_page_pre_decoder.h rewrites the inner V3 page to V1.
CHAR dictionary words are unpadded on read via the (CHAR, V3) IS_CHAR pre-decoder.
- HLL/BITMAP/QUANTILE_STATE/AGG_STATE -> PLAIN_ENCODING_V3 (_set_v3_default).
- the hidden row store column -> PLAIN_ENCODING_V3 (resolve_default_encoding).
Benchmarks (be/benchmark/benchmark_binary_plain_page_v2.hpp):
- V2 vs V3 pre-decode speed at fixed page sizes; V3 is faster for short/medium values
(~2.4-2.9x at <=64B) and never slower (1.0x at 4KB).
- V2 vs V3 on-disk size after ZSTD compression; same bytes, the V3 layout compresses
slightly better (smaller for short values).
- benchmark_main.cpp uses a custom main (DataPage allocation needs a ThreadContext +
mem tracker) and re-enables binary_cast_benchmark (it was wrongly disabled; the real
issue was include order, fixed by keeping our hpp last).
Tests: BinaryPlainPageV3Test (encode/decode/seek/read_by_rowids/empty/page_full/varint
boundaries/corruption, plus padded-CHAR round-trips that exercise the IS_CHAR read-side
strip), BinaryDictPageTest V3 round-trips (word page + dict-overflow fallback),
EncodingInfoTest defaults + pre-decoder dispatch, and column_meta_accessor / variant /
encoding_info expectation updates. All pass under ASAN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 2, 2026
… segments
Introduce PLAIN_ENCODING_V3, a binary plain page whose on-disk layout is
|data1..dataN|varuint_len1..varuint_lenN|data_block_size(u32)|num_elems(u32)|.
Unlike V2 (length and data interleaved per entry), the contiguous layout lets the
pre-decoder memcpy the whole data block in one shot and walk the varint lengths once
to fill the V1 offsets array, with no data-vs-length pointer dependency between the
two passes.
V3 stores exactly the same bytes as V1/V2 — only the layout differs. In particular
CHAR keeps its trailing '\0' padding on disk (written by OlapColumnDataConvertorChar),
VARCHAR does not; the CHAR padding is stripped on read by BinaryPlainPageV3PreDecoder
<true>, mirroring PLAIN_ENCODING_V2.
Write/read wiring (post-apache#63622 EncodingInfoResolver):
- encoding_info.cpp: TypeEncodingTraits<PLAIN_ENCODING_V3> (CppType + Slice),
_register_supported_encoding for every binary type, and the IS_CHAR-aware V3
pre-decoder dispatch in the EncodingInfo constructor.
- binary_plain_page_v3.h / binary_plain_page_v3_pre_decoder.h: builder and the
template<bool IS_CHAR> pre-decoder (CHAR strnlen-strips on read; non-CHAR takes the
single-memcpy fast path).
- gensrc protos: new EncodingTypePB (=9) and BinaryPlainEncodingTypePB (=3).
V3 segment defaults — every binary-plain default now uses the V3 layout:
- CHAR/VARCHAR/STRING/JSONB/VARIANT keep DICT_ENCODING, but the dictionary word page
(and the dict-overflow fallback plain page) use V3: ScalarColumnWriter::init sets
dict_binary_plain_encoding to V3, binary_dict_page.cpp maps it and dispatches the V3
inner encoding, and binary_dict_page_pre_decoder.h rewrites the inner V3 page to V1.
CHAR dictionary words are unpadded on read via the (CHAR, V3) IS_CHAR pre-decoder.
- HLL/BITMAP/QUANTILE_STATE/AGG_STATE -> PLAIN_ENCODING_V3 (_set_v3_default).
- the hidden row store column -> PLAIN_ENCODING_V3 (resolve_default_encoding).
Benchmarks (be/benchmark/benchmark_binary_plain_page_v2.hpp):
- V2 vs V3 pre-decode speed at fixed page sizes; V3 is faster for short/medium values
(~2.4-2.9x at <=64B) and never slower (1.0x at 4KB).
- V2 vs V3 on-disk size after ZSTD compression; same bytes, the V3 layout compresses
slightly better (smaller for short values).
- benchmark_main.cpp uses a custom main (DataPage allocation needs a ThreadContext +
mem tracker) and re-enables binary_cast_benchmark (it was wrongly disabled; the real
issue was include order, fixed by keeping our hpp last).
Tests: BinaryPlainPageV3Test (encode/decode/seek/read_by_rowids/empty/page_full/varint
boundaries/corruption, plus padded-CHAR round-trips that exercise the IS_CHAR read-side
strip), BinaryDictPageTest V3 round-trips (word page + dict-overflow fallback),
EncodingInfoTest defaults + pre-decoder dispatch, and column_meta_accessor / variant /
encoding_info expectation updates. All pass under ASAN.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
zhaorongsheng pushed a commit to zhaorongsheng/doris that referenced this pull request Jun 4, 2026
…he#63622)
Replace the EncodingPreference + runtime hook machinery in
EncodingInfoResolver with four explicit maps and four matching get
methods:
- _v2_default_map -> get_v2_default_encoding(type)
- _v3_default_map -> get_v3_default_encoding(type)
- _index_column_default_map -> get_index_column_encoding(type)
- _encoding_map -> get(type, encoding, out)
No on-disk format change; the resolved encodings written into
ColumnMetaPB match the pre-refactor outputs for both v2 and V3 tablets.
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [x] 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 <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
csun5285 added a commit to csun5285/doris that referenced this pull request Jun 16, 2026
…he#63622)
Replace the EncodingPreference + runtime hook machinery in
EncodingInfoResolver with four explicit maps and four matching get
methods:
- _v2_default_map -> get_v2_default_encoding(type)
- _v3_default_map -> get_v3_default_encoding(type)
- _index_column_default_map -> get_index_column_encoding(type)
- _encoding_map -> get(type, encoding, out)
No on-disk format change; the resolved encodings written into
ColumnMetaPB match the pre-refactor outputs for both v2 and V3 tablets.
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
None
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [x] 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 <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4f1dcdf)
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>
bobhan1 added a commit to bobhan1/doris that referenced this pull request Aug 14, 2026
### What problem does this PR solve?
Issue Number: None
Related PR: apache#63622
Problem Summary: Segment V3 continued to select BIT_SHUFFLE for FLOAT and DOUBLE columns. The original implementation required a tablet-schema flag propagated through proto, FE, Cloud, and BE writers. After apache#63622 split encoding selection into explicit V2 and V3 maps, that propagation chain is obsolete. Express the behavior directly in the V3 default map, preserve the V2 BIT_SHUFFLE default for compatibility, and lock the distinction with unit and end-to-end regression coverage.
### Release note
Segment V3 now uses PLAIN encoding by default for FLOAT and DOUBLE columns. Segment V2 behavior is unchanged.
### Check List (For Author)
- Test: Unit Test / Regression test / Build
- `./build.sh --be -j100`
- `./build.sh --fe -j100`
- `./run-be-ut.sh --run --filter=EncodingInfoTest.* -j100` (8 tests passed)
- `./run-regression-test.sh --run -d table_p0 -s test_storage_format_controls_encoding` (1 suite passed)
- `build-support/clang-format.sh` and `build-support/check-format.sh`
- Behavior changed: Yes. Newly written V3 FLOAT and DOUBLE pages use PLAIN instead of BIT_SHUFFLE; V2 remains BIT_SHUFFLE.
- Does this need documentation: No
bobhan1 added a commit to bobhan1/doris that referenced this pull request Aug 18, 2026
### What problem does this PR solve?
Issue Number: None
Related PR: apache#63622
Problem Summary: Segment V3 continued to select BIT_SHUFFLE for FLOAT and DOUBLE columns. The original implementation required a tablet-schema flag propagated through proto, FE, Cloud, and BE writers. After apache#63622 split encoding selection into explicit V2 and V3 maps, that propagation chain is obsolete. Express the behavior directly in the V3 default map, preserve the V2 BIT_SHUFFLE default for compatibility, and lock the distinction with unit and end-to-end regression coverage.
### Release note
Segment V3 now uses PLAIN encoding by default for FLOAT and DOUBLE columns. Segment V2 behavior is unchanged.
### Check List (For Author)
- Test: Unit Test / Regression test / Build
- `./build.sh --be -j100`
- `./build.sh --fe -j100`
- `./run-be-ut.sh --run --filter=EncodingInfoTest.* -j100` (8 tests passed)
- `./run-regression-test.sh --run -d table_p0 -s test_storage_format_controls_encoding` (1 suite passed)
- `build-support/clang-format.sh` and `build-support/check-format.sh`
- Behavior changed: Yes. Newly written V3 FLOAT and DOUBLE pages use PLAIN instead of BIT_SHUFFLE; V2 remains BIT_SHUFFLE.
- Does this need documentation: No
bobhan1 added a commit to bobhan1/doris that referenced this pull request Aug 18, 2026
### What problem does this PR solve?
Issue Number: None
Related PR: apache#63622
Problem Summary: Segment V3 continued to select BIT_SHUFFLE for FLOAT and DOUBLE columns. The original implementation required a tablet-schema flag propagated through proto, FE, Cloud, and BE writers. After apache#63622 split encoding selection into explicit V2 and V3 maps, that propagation chain is obsolete. Express the behavior directly in the V3 default map, preserve the V2 BIT_SHUFFLE default for compatibility, and lock the distinction with unit, golden-format, and end-to-end regression coverage.
### Release note
Segment V3 now uses PLAIN encoding by default for FLOAT and DOUBLE columns. Segment V2 behavior is unchanged.
### Check List (For Author)
- Test: Unit Test / Regression test / Build
- `./build.sh --be -j100`
- `./build.sh --fe -j100`
- `./run-be-ut.sh --run '--filter=EncodingInfoTest.*:SegmentFlusherFormatTest.AllSupportedScalarValueTypesKeepTheirSegmentBytes' -j100` (9 tests passed)
- `./run-regression-test.sh --run -d table_p0 -s test_storage_format_controls_encoding` (1 suite passed)
- `build-support/clang-format.sh` and `build-support/check-format.sh`
- Behavior changed: Yes. Newly written V3 FLOAT and DOUBLE pages use PLAIN instead of BIT_SHUFFLE; V2 remains BIT_SHUFFLE.
- Does this need documentation: No
bobhan1 added a commit to bobhan1/doris that referenced this pull request Aug 26, 2026
### What problem does this PR solve?
Issue Number: None
Related PR: apache#63622
Problem Summary: Segment V3 continued to select BIT_SHUFFLE for FLOAT and DOUBLE columns. The original implementation required a tablet-schema flag propagated through proto, FE, Cloud, and BE writers. After apache#63622 split encoding selection into explicit V2 and V3 maps and persisted storage_format in TabletSchema, that propagation chain is obsolete. Express the behavior directly in the V3 default map, preserve the V2 BIT_SHUFFLE default for compatibility, and refresh all affected scalar and materialized Variant Segment goldens.
### Release note
Segment V3 now uses PLAIN encoding by default for FLOAT and DOUBLE columns. Segment V2 behavior is unchanged.
### Check List (For Author)
- Test: Unit Test
- `./run-be-ut.sh --run --filter='SegmentFlusherFormatTest.*KeepTheirSegmentBytes:SegmentFlusherTransformFormatTest.PartialUpdateAndRowBinlogPathsKeepTheirSegmentBytes' -j100` (6 tests passed in two generation runs; all 164 generated Segment files were byte-identical between runs)
- `./run-be-ut.sh --run --filter='EncodingInfoTest.*:SegmentFlusherFormatTest.*:SegmentFlusherTransformFormatTest.*' -j100` (17 tests passed against the checked-in goldens)
- `build-support/clang-format.sh`
- `build-support/check-format.sh`
- `git diff --check`
- Behavior changed: Yes. Newly written V3 FLOAT and DOUBLE pages use PLAIN instead of BIT_SHUFFLE; V2 remains BIT_SHUFFLE.
- Does this need documentation: No
bobhan1 added a commit to bobhan1/doris that referenced this pull request Aug 26, 2026
### What problem does this PR solve?
Issue Number: None
Related PR: apache#63622
Problem Summary: Segment V3 continued to select BIT_SHUFFLE for FLOAT and DOUBLE columns. The original implementation required a tablet-schema flag propagated through proto, FE, Cloud, and BE writers. After apache#63622 split encoding selection into explicit V2 and V3 maps and persisted storage_format in TabletSchema, that propagation chain is obsolete. Express the behavior directly in the V3 default map, preserve the V2 BIT_SHUFFLE default for compatibility, and refresh all affected scalar and materialized Variant Segment goldens.
### Release note
Segment V3 now uses PLAIN encoding by default for FLOAT and DOUBLE columns. Segment V2 behavior is unchanged.
### Check List (For Author)
- Test: Unit Test
- `./run-be-ut.sh --run --filter='SegmentFlusherFormatTest.*KeepTheirSegmentBytes:SegmentFlusherTransformFormatTest.PartialUpdateAndRowBinlogPathsKeepTheirSegmentBytes' -j100` (6 tests passed in two generation runs; all 164 generated Segment files were byte-identical between runs)
- `./run-be-ut.sh --run --filter='EncodingInfoTest.*:SegmentFlusherFormatTest.*:SegmentFlusherTransformFormatTest.*' -j100` (17 tests passed against the checked-in goldens)
- `build-support/clang-format.sh`
- `build-support/check-format.sh`
- `git diff --check`
- Behavior changed: Yes. Newly written V3 FLOAT and DOUBLE pages use PLAIN instead of BIT_SHUFFLE; V2 remains BIT_SHUFFLE.
- Does this need documentation: No
gavinchou pushed a commit that referenced this pull request Aug 27, 2026
…62649)
Related PR: #63622
Problem Summary: Segment V3 continued to select `BIT_SHUFFLE` for
`FLOAT` and `DOUBLE` columns. The original implementation added a
tablet-schema flag and propagated it through proto, FE, Cloud, and BE
writers. After #63622 split encoding selection into explicit V2 and V3
maps and persisted `storage_format` in `TabletSchema`, that propagation
chain is obsolete. This PR expresses the behavior directly in the V3
default map while preserving the V2 default for compatibility.
Changes:
- Use `PLAIN_ENCODING` as the V3 default for `FLOAT` and `DOUBLE`.
- Keep the V2 default as `BIT_SHUFFLE`.
- Update the authoritative encoding-map unit tests to lock both
behaviors.
- Regenerate all ten affected SegmentFlusher golden files across the two
scalar and four complex Variant V3 cases.
### Release note
Segment V3 now uses PLAIN encoding by default for FLOAT and DOUBLE
columns. Segment V2 behavior is unchanged.
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@yiguolei@bobhan1@gavinchou