Skip to content

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented May 6, 2025

What problem does this PR solve?

In the code below, if the column size is 0, an empty vector will be created. A vector with size 0 may return nullptr from data()
https://en.cppreference.com/w/cpp/container/vector/data
If size() is ​0​, data() may or may not return a null pointer.
This would trigger a ubsan error: null pointer passed as argument 2, which is declared to never be null
Other data types don't have this issue because they use Doris internal pod array that guarantees data won't be nullptr.

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

@Thearas
Copy link
Contributor

Thearas commented May 6, 2025

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Mryange
Copy link
Contributor Author

Mryange commented May 6, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	25694	5070	4992	4992
q2	2059	273	188	188
q3	10477	1237	689	689
q4	10227	985	513	513
q5	7935	2318	2736	2318
q6	186	162	129	129
q7	904	764	612	612
q8	9327	1296	1082	1082
q9	6833	5061	5035	5035
q10	6837	2296	1865	1865
q11	482	270	264	264
q12	340	362	212	212
q13	17791	3615	3157	3157
q14	232	221	206	206
q15	527	467	487	467
q16	410	414	363	363
q17	560	842	359	359
q18	7394	7252	7163	7163
q19	1504	944	542	542
q20	332	327	219	219
q21	3801	2615	2428	2428
q22	1028	1000	951	951
Total cold run time: 114880 ms
Total hot run time: 33754 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5073	5034	5074	5034
q2	230	317	228	228
q3	2120	2618	2268	2268
q4	1321	1754	1315	1315
q5	4349	4355	4422	4355
q6	213	170	124	124
q7	1996	1941	1751	1751
q8	2550	2623	2523	2523
q9	7231	7186	7033	7033
q10	2964	3154	2744	2744
q11	567	509	480	480
q12	678	762	608	608
q13	3447	3885	3223	3223
q14	289	283	286	283
q15	539	484	503	484
q16	428	490	427	427
q17	1116	1569	1356	1356
q18	7593	7556	7527	7527
q19	788	813	820	813
q20	1963	2002	1828	1828
q21	5092	4675	4844	4675
q22	1092	1063	1005	1005
Total cold run time: 51639 ms
Total hot run time: 50084 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192365 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 788c3f9b6c74a67bc1623b96153cb86509f209fe, data reload: false

query1	1424	1098	1064	1064
query2	6280	1738	1776	1738
query3	11017	4510	4366	4366
query4	26113	23691	23465	23465
query5	5298	624	461	461
query6	323	204	195	195
query7	3987	484	291	291
query8	303	260	247	247
query9	8543	2546	2551	2546
query10	526	307	273	273
query11	15270	15056	14838	14838
query12	160	109	109	109
query13	1566	523	390	390
query14	9430	6121	5971	5971
query15	206	185	177	177
query16	7573	639	467	467
query17	1161	776	605	605
query18	2034	408	312	312
query19	194	187	173	173
query20	125	123	118	118
query21	210	124	116	116
query22	4662	4582	4427	4427
query23	35054	33651	33439	33439
query24	8712	2410	2416	2410
query25	548	484	426	426
query26	995	281	159	159
query27	2912	517	340	340
query28	4464	2136	2114	2114
query29	656	619	476	476
query30	279	239	191	191
query31	919	874	785	785
query32	76	64	66	64
query33	542	358	322	322
query34	789	869	517	517
query35	807	825	749	749
query36	979	1041	927	927
query37	111	103	75	75
query38	4213	4236	4246	4236
query39	1485	1431	1431	1431
query40	217	117	104	104
query41	55	52	52	52
query42	118	144	117	117
query43	493	500	452	452
query44	1328	803	800	800
query45	176	175	165	165
query46	853	1023	643	643
query47	1832	1900	1810	1810
query48	378	413	297	297
query49	720	495	438	438
query50	666	689	403	403
query51	4263	4248	4140	4140
query52	109	107	105	105
query53	225	257	185	185
query54	593	588	515	515
query55	85	80	75	75
query56	300	292	287	287
query57	1172	1185	1114	1114
query58	282	282	250	250
query59	2648	2771	2611	2611
query60	331	336	315	315
query61	128	129	127	127
query62	778	742	715	715
query63	227	186	191	186
query64	3478	1103	692	692
query65	4441	4361	4346	4346
query66	794	414	305	305
query67	15931	15555	15415	15415
query68	8522	898	499	499
query69	509	306	271	271
query70	1187	1107	1109	1107
query71	516	317	295	295
query72	5731	4739	4786	4739
query73	708	619	346	346
query74	9379	9265	8903	8903
query75	4121	3220	2689	2689
query76	3748	1188	739	739
query77	789	367	280	280
query78	10101	10092	9202	9202
query79	2476	806	573	573
query80	662	500	458	458
query81	468	264	221	221
query82	477	126	98	98
query83	284	254	235	235
query84	297	109	86	86
query85	757	358	317	317
query86	369	317	345	317
query87	4450	4391	4385	4385
query88	3507	2255	2215	2215
query89	408	314	290	290
query90	1910	212	214	212
query91	142	140	108	108
query92	77	60	55	55
query93	1802	960	573	573
query94	663	415	301	301
query95	362	298	291	291
query96	484	637	274	274
query97	3153	3290	3105	3105
query98	238	219	209	209
query99	1463	1396	1298	1298
Total cold run time: 282327 ms
Total hot run time: 192365 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 28.42 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 788c3f9b6c74a67bc1623b96153cb86509f209fe, data reload: false

query1	0.04	0.04	0.02
query2	0.13	0.10	0.11
query3	0.25	0.19	0.19
query4	1.61	0.19	0.11
query5	0.55	0.53	0.55
query6	1.20	0.71	0.73
query7	0.02	0.02	0.02
query8	0.04	0.03	0.03
query9	0.59	0.51	0.51
query10	0.57	0.56	0.56
query11	0.16	0.10	0.10
query12	0.15	0.12	0.11
query13	0.61	0.60	0.59
query14	0.78	0.81	0.81
query15	0.86	0.87	0.85
query16	0.38	0.37	0.38
query17	1.02	1.03	1.07
query18	0.20	0.19	0.19
query19	1.95	1.75	1.74
query20	0.02	0.01	0.01
query21	15.44	0.91	0.57
query22	0.76	1.15	0.62
query23	14.96	1.38	0.66
query24	7.07	1.90	0.39
query25	0.34	0.13	0.06
query26	0.59	0.17	0.13
query27	0.05	0.05	0.05
query28	8.98	0.90	0.45
query29	12.53	3.91	3.26
query30	0.26	0.09	0.06
query31	2.82	0.61	0.38
query32	3.22	0.56	0.46
query33	3.05	3.00	3.15
query34	15.83	5.11	4.46
query35	4.49	4.48	4.51
query36	0.67	0.50	0.48
query37	0.09	0.06	0.07
query38	0.05	0.04	0.04
query39	0.03	0.03	0.02
query40	0.17	0.13	0.13
query41	0.08	0.03	0.03
query42	0.03	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 102.68 s
Total hot run time: 28.42 s

@Mryange
Copy link
Contributor Author

Mryange commented May 7, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	26254	5004	4954	4954
q2	2072	275	174	174
q3	10417	1212	720	720
q4	10221	994	511	511
q5	7523	2360	2335	2335
q6	180	167	135	135
q7	905	742	597	597
q8	9318	1218	1036	1036
q9	6902	5122	5075	5075
q10	6802	2302	1867	1867
q11	465	279	279	279
q12	339	344	214	214
q13	17773	3635	3072	3072
q14	238	223	220	220
q15	530	488	473	473
q16	409	432	372	372
q17	583	852	354	354
q18	7508	7205	6998	6998
q19	1223	934	558	558
q20	340	343	218	218
q21	3795	3332	2383	2383
q22	1002	988	962	962
Total cold run time: 114799 ms
Total hot run time: 33507 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5065	5016	5027	5016
q2	237	323	227	227
q3	2092	2675	2239	2239
q4	1338	1747	1372	1372
q5	4396	4435	4422	4422
q6	216	169	129	129
q7	1994	1908	1761	1761
q8	2529	2642	2472	2472
q9	7115	7052	7100	7052
q10	3027	3145	2719	2719
q11	558	518	489	489
q12	658	726	589	589
q13	3481	3878	3263	3263
q14	294	295	261	261
q15	530	480	474	474
q16	415	491	435	435
q17	1139	1513	1379	1379
q18	7547	7395	7359	7359
q19	785	777	938	777
q20	1930	1975	1857	1857
q21	5168	4655	4461	4461
q22	1033	1023	975	975
Total cold run time: 51547 ms
Total hot run time: 49728 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 185409 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 4e0d44d68227ae159589e5e78cb2ed62cb4b9860, data reload: false

query1	1011	483	495	483
query2	6585	1824	1789	1789
query3	6749	213	215	213
query4	26167	23572	23232	23232
query5	4403	627	475	475
query6	310	245	192	192
query7	4619	492	281	281
query8	299	257	223	223
query9	8617	2518	2565	2518
query10	485	304	269	269
query11	15343	15424	14782	14782
query12	156	106	107	106
query13	1643	504	394	394
query14	8741	6102	6310	6102
query15	203	188	174	174
query16	7127	620	475	475
query17	919	724	583	583
query18	1973	407	301	301
query19	191	191	162	162
query20	127	117	113	113
query21	217	124	105	105
query22	4045	4112	4121	4112
query23	33717	32991	32745	32745
query24	8462	2387	2361	2361
query25	562	471	459	459
query26	1247	267	149	149
query27	2753	501	325	325
query28	4367	2091	2063	2063
query29	752	536	429	429
query30	279	212	186	186
query31	931	829	750	750
query32	72	65	64	64
query33	555	369	376	369
query34	772	840	518	518
query35	771	797	727	727
query36	968	977	881	881
query37	108	101	79	79
query38	4116	4110	4025	4025
query39	1514	1390	1387	1387
query40	215	115	105	105
query41	56	58	50	50
query42	127	109	104	104
query43	498	481	483	481
query44	1250	775	783	775
query45	170	178	171	171
query46	829	1035	626	626
query47	1776	1765	1752	1752
query48	372	422	292	292
query49	762	509	422	422
query50	618	677	398	398
query51	4049	4099	4061	4061
query52	112	100	97	97
query53	216	242	179	179
query54	588	549	504	504
query55	84	82	84	82
query56	300	294	281	281
query57	1132	1157	1101	1101
query58	267	269	246	246
query59	2667	2731	2598	2598
query60	326	319	306	306
query61	127	125	127	125
query62	798	735	645	645
query63	214	184	177	177
query64	4395	1028	738	738
query65	4300	4202	4247	4202
query66	1171	411	305	305
query67	15566	15517	15397	15397
query68	8460	911	512	512
query69	473	313	264	264
query70	1205	1037	1022	1022
query71	472	303	292	292
query72	5421	4780	4807	4780
query73	722	640	342	342
query74	8795	9152	8856	8856
query75	3830	3215	2675	2675
query76	3662	1179	737	737
query77	804	370	285	285
query78	9905	9999	9353	9353
query79	2759	805	564	564
query80	655	518	449	449
query81	472	254	220	220
query82	471	126	97	97
query83	280	250	233	233
query84	301	104	87	87
query85	789	352	318	318
query86	339	302	287	287
query87	4391	4403	4327	4327
query88	2812	2204	2235	2204
query89	420	318	283	283
query90	1925	203	210	203
query91	155	144	112	112
query92	80	61	58	58
query93	2022	946	577	577
query94	678	411	307	307
query95	369	291	319	291
query96	475	552	273	273
query97	3145	3202	3098	3098
query98	230	207	197	197
query99	1440	1448	1285	1285
Total cold run time: 272818 ms
Total hot run time: 185409 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 28.66 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 4e0d44d68227ae159589e5e78cb2ed62cb4b9860, data reload: false

query1	0.04	0.03	0.04
query2	0.12	0.10	0.10
query3	0.25	0.20	0.19
query4	1.60	0.19	0.10
query5	0.57	0.56	0.54
query6	1.19	0.72	0.72
query7	0.02	0.02	0.01
query8	0.05	0.04	0.03
query9	0.58	0.53	0.52
query10	0.58	0.57	0.59
query11	0.16	0.10	0.11
query12	0.15	0.12	0.12
query13	0.61	0.60	0.60
query14	0.78	0.80	0.81
query15	0.88	0.82	0.86
query16	0.38	0.37	0.38
query17	1.01	1.05	1.04
query18	0.21	0.19	0.20
query19	1.89	1.77	1.81
query20	0.01	0.01	0.01
query21	15.42	0.90	0.57
query22	0.74	1.10	0.60
query23	15.10	1.38	0.63
query24	7.10	1.32	0.55
query25	0.45	0.26	0.06
query26	0.62	0.17	0.13
query27	0.05	0.05	0.05
query28	8.72	0.91	0.43
query29	12.74	3.98	3.29
query30	0.26	0.09	0.06
query31	2.82	0.59	0.38
query32	3.22	0.54	0.47
query33	3.00	3.05	3.06
query34	15.81	5.08	4.47
query35	4.48	4.50	4.48
query36	0.69	0.50	0.49
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.02	0.02
query40	0.16	0.14	0.13
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 102.79 s
Total hot run time: 28.66 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 100.00% (3/3) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 55.51% (14844/26743)
Line Coverage 44.54% (130911/293940)
Region Coverage 43.27% (66689/154126)
Branch Coverage 37.87% (33657/88864)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (3/3) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 81.23% (21316/26241)
Line Coverage 75.14% (220490/293427)
Region Coverage 73.45% (132631/180567)
Branch Coverage 66.78% (67742/101440)

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label May 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit c742b80 into apache:master May 7, 2025
26 of 29 checks passed
github-actions bot pushed a commit that referenced this pull request May 7, 2025
### What problem does this PR solve?

In the code below, if the column size is 0, an empty vector will be
created. A vector with size 0 may return nullptr from data()
https://en.cppreference.com/w/cpp/container/vector/data
`If size() is ​0​, data() may or may not return a null pointer.`
This would trigger a ubsan error: `null pointer passed as argument 2,
which is declared to never be null`
Other data types don't have this issue because they use Doris internal
pod array that guarantees data won't be nullptr.
dataroaring pushed a commit that referenced this pull request May 13, 2025
### What problem does this PR solve?

In the code below, if the column size is 0, an empty vector will be
created. A vector with size 0 may return nullptr from data()
https://en.cppreference.com/w/cpp/container/vector/data
`If size() is ​0​, data() may or may not return a null pointer.`
This would trigger a ubsan error: `null pointer passed as argument 2,
which is declared to never be null`
Other data types don't have this issue because they use Doris internal
pod array that guarantees data won't be nullptr.
dataroaring pushed a commit that referenced this pull request May 14, 2025
…0628 (#50668)

Cherry-picked from #50628

Co-authored-by: Mryange <yanxuecheng@selectdb.com>
koarz pushed a commit to koarz/doris that referenced this pull request Jun 4, 2025
### What problem does this PR solve?

In the code below, if the column size is 0, an empty vector will be
created. A vector with size 0 may return nullptr from data()
https://en.cppreference.com/w/cpp/container/vector/data
`If size() is ​0​, data() may or may not return a null pointer.`
This would trigger a ubsan error: `null pointer passed as argument 2,
which is declared to never be null`
Other data types don't have this issue because they use Doris internal
pod array that guarantees data won't be nullptr.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants