Skip to content

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented Jul 21, 2025

What problem does this PR solve?

my_double_round did not handle NaN values correctly. For example, when dec is very large and value is 0, there will be a case of 0 * inf, resulting in a NaN value.
do_format_round assumes the input is always a valid double value, which causes a core dump when a NaN is passed in.

Additionally,
(value.size() - (is_positive ? (decimal_places + 2) : (decimal_places + 3))) / 3;
This code does not account for the situation where value.size() is 0.

Currently, a custom add_thousands_separator function is implemented. If the fmt library is upgraded in the future, we should use fmt to add thousands separators.

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 Jul 21, 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 Jul 21, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17586	5176	5028	5028
q2	1938	304	192	192
q3	10276	1291	757	757
q4	10250	1032	512	512
q5	7554	2417	2294	2294
q6	190	172	141	141
q7	920	769	618	618
q8	9342	1325	1116	1116
q9	6778	5057	5138	5057
q10	6900	2371	1984	1984
q11	501	312	284	284
q12	359	378	229	229
q13	17768	3680	3132	3132
q14	234	239	230	230
q15	585	521	515	515
q16	428	449	396	396
q17	568	873	349	349
q18	7459	7110	7239	7110
q19	1246	978	595	595
q20	352	377	244	244
q21	3644	3175	2317	2317
q22	1042	1026	969	969
Total cold run time: 105920 ms
Total hot run time: 34069 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5102	5105	5035	5035
q2	270	356	242	242
q3	2207	2615	2253	2253
q4	1388	1748	1357	1357
q5	4221	4420	4352	4352
q6	227	180	174	174
q7	2007	1993	1780	1780
q8	2614	2621	2563	2563
q9	7280	7260	7300	7260
q10	3111	3308	2889	2889
q11	577	544	509	509
q12	680	770	645	645
q13	3572	4017	3381	3381
q14	303	324	286	286
q15	549	513	501	501
q16	450	497	461	461
q17	1190	1600	1411	1411
q18	8044	7944	7389	7389
q19	851	780	889	780
q20	2085	2142	1901	1901
q21	4971	4568	4438	4438
q22	1096	1071	1001	1001
Total cold run time: 52795 ms
Total hot run time: 50608 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 190539 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 f4b790bc567bf3ff01e99d4b78433c605f5f2839, data reload: false

query1	1013	387	407	387
query2	6587	1713	1698	1698
query3	6771	243	229	229
query4	26420	23725	23321	23321
query5	4472	719	585	585
query6	321	270	234	234
query7	4653	507	301	301
query8	388	333	334	333
query9	8629	2889	2881	2881
query10	515	378	341	341
query11	15507	15051	14831	14831
query12	179	131	131	131
query13	1709	564	474	474
query14	9192	5938	5856	5856
query15	224	195	178	178
query16	7723	639	473	473
query17	1210	711	598	598
query18	2036	421	333	333
query19	203	197	175	175
query20	145	132	126	126
query21	234	142	138	138
query22	4236	4219	4117	4117
query23	34039	33375	33085	33085
query24	8184	2385	2379	2379
query25	541	493	449	449
query26	1046	281	176	176
query27	2699	524	351	351
query28	4382	2172	2155	2155
query29	661	590	469	469
query30	301	232	211	211
query31	955	857	789	789
query32	90	90	81	81
query33	569	396	377	377
query34	808	847	544	544
query35	818	879	790	790
query36	1000	1005	947	947
query37	123	110	96	96
query38	4114	4074	4108	4074
query39	1524	1501	1485	1485
query40	245	145	136	136
query41	107	102	103	102
query42	131	118	121	118
query43	523	516	516	516
query44	1338	903	857	857
query45	192	186	216	186
query46	842	1016	647	647
query47	1823	1873	1808	1808
query48	398	461	354	354
query49	755	561	468	468
query50	661	716	430	430
query51	5489	5542	5498	5498
query52	129	118	112	112
query53	253	283	209	209
query54	610	613	554	554
query55	97	93	93	93
query56	342	383	348	348
query57	1251	1234	1189	1189
query58	327	307	318	307
query59	2573	2667	2587	2587
query60	381	364	353	353
query61	154	150	167	150
query62	829	724	692	692
query63	244	213	211	211
query64	3726	1068	745	745
query65	4289	4219	4202	4202
query66	1150	581	576	576
query67	15793	15810	15600	15600
query68	8615	895	541	541
query69	503	340	310	310
query70	1242	1138	1110	1110
query71	487	360	332	332
query72	5299	4657	4661	4657
query73	732	592	374	374
query74	8994	9163	8868	8868
query75	4044	3171	2755	2755
query76	3634	1132	721	721
query77	867	453	434	434
query78	9955	10115	9419	9419
query79	4232	849	591	591
query80	719	592	516	516
query81	479	269	244	244
query82	350	148	118	118
query83	318	284	272	272
query84	315	114	100	100
query85	794	396	363	363
query86	362	329	332	329
query87	4453	4474	4373	4373
query88	2975	2440	2391	2391
query89	451	337	304	304
query90	2096	241	241	241
query91	149	156	170	156
query92	107	83	77	77
query93	2459	926	596	596
query94	681	416	324	324
query95	409	332	331	331
query96	495	600	290	290
query97	2751	2799	2644	2644
query98	246	230	226	226
query99	1441	1430	1286	1286
Total cold run time: 279527 ms
Total hot run time: 190539 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.08	0.05	0.05
query3	0.24	0.08	0.07
query4	1.62	0.11	0.11
query5	0.43	0.43	0.42
query6	1.17	0.65	0.67
query7	0.02	0.02	0.02
query8	0.06	0.04	0.04
query9	0.59	0.52	0.51
query10	0.58	0.58	0.58
query11	0.17	0.12	0.12
query12	0.15	0.12	0.12
query13	0.64	0.61	0.61
query14	0.80	0.82	0.82
query15	0.90	0.89	0.88
query16	0.39	0.39	0.40
query17	1.08	1.08	1.08
query18	0.23	0.21	0.21
query19	1.95	1.86	1.84
query20	0.01	0.01	0.02
query21	15.36	0.88	0.54
query22	0.79	1.24	0.74
query23	14.78	1.39	0.61
query24	7.38	0.62	0.57
query25	0.51	0.25	0.13
query26	0.53	0.17	0.14
query27	0.05	0.06	0.06
query28	9.73	0.97	0.45
query29	12.61	3.90	3.30
query30	3.14	3.13	3.04
query31	2.83	0.58	0.39
query32	3.23	0.55	0.48
query33	3.03	3.08	3.10
query34	15.92	5.42	4.82
query35	4.87	4.89	4.88
query36	0.73	0.51	0.49
query37	0.10	0.07	0.08
query38	0.07	0.05	0.04
query39	0.04	0.03	0.03
query40	0.19	0.15	0.15
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 107.22 s
Total hot run time: 32.68 s

// Find the position of the decimal point
size_t dot_pos = formatted_num.find('.');
if (dot_pos == std::string::npos) {
dot_pos = formatted_num.size(); // 没有小数点
Copy link
Contributor

Choose a reason for hiding this comment

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

Chinese comment

@Mryange
Copy link
Contributor Author

Mryange commented Jul 21, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17614	5282	5064	5064
q2	1919	298	204	204
q3	10288	1286	704	704
q4	10221	1021	551	551
q5	7575	2434	2320	2320
q6	188	187	142	142
q7	932	773	648	648
q8	9349	1320	1115	1115
q9	7337	5132	5061	5061
q10	6894	2403	1973	1973
q11	505	317	296	296
q12	361	365	232	232
q13	17777	3712	3085	3085
q14	241	235	231	231
q15	598	520	528	520
q16	439	439	398	398
q17	587	886	364	364
q18	7431	7164	7216	7164
q19	1584	993	584	584
q20	355	344	252	252
q21	3663	3184	2346	2346
q22	1083	1016	963	963
Total cold run time: 106941 ms
Total hot run time: 34217 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5138	5105	5136	5105
q2	261	347	241	241
q3	2225	2679	2246	2246
q4	1390	1786	1351	1351
q5	4301	4501	4449	4449
q6	219	178	140	140
q7	2072	1970	1772	1772
q8	2638	2603	2568	2568
q9	7260	7257	7306	7257
q10	3108	3385	2859	2859
q11	597	515	506	506
q12	710	772	621	621
q13	3453	4286	3269	3269
q14	307	311	302	302
q15	548	511	514	511
q16	482	522	450	450
q17	1168	1547	1414	1414
q18	7780	7721	7466	7466
q19	805	834	884	834
q20	2144	2076	1973	1973
q21	5083	4554	4385	4385
q22	1070	1058	1017	1017
Total cold run time: 52759 ms
Total hot run time: 50736 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 190515 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 650fbb9ccc41e953d761f1be844963e0fe9b38ce, data reload: false

query1	1017	390	418	390
query2	6579	1769	1744	1744
query3	6750	230	217	217
query4	26493	23785	23214	23214
query5	4463	729	610	610
query6	347	262	231	231
query7	4640	528	310	310
query8	387	343	339	339
query9	8652	2930	2896	2896
query10	523	393	323	323
query11	15754	15278	14799	14799
query12	185	136	131	131
query13	1699	568	476	476
query14	10066	6081	5951	5951
query15	218	199	180	180
query16	7659	687	469	469
query17	1288	729	597	597
query18	2036	449	369	369
query19	204	196	174	174
query20	137	132	126	126
query21	228	141	129	129
query22	4043	4264	4088	4088
query23	34231	33383	33414	33383
query24	8175	2395	2425	2395
query25	571	497	433	433
query26	1223	279	168	168
query27	2714	512	373	373
query28	4345	2203	2167	2167
query29	746	576	471	471
query30	312	247	237	237
query31	980	855	799	799
query32	89	89	87	87
query33	594	404	369	369
query34	815	860	539	539
query35	829	858	761	761
query36	1010	1015	944	944
query37	136	116	97	97
query38	4204	4251	4125	4125
query39	1554	1462	1491	1462
query40	240	146	133	133
query41	115	104	105	104
query42	135	121	122	121
query43	528	520	483	483
query44	1422	870	866	866
query45	192	186	183	183
query46	849	1020	652	652
query47	1828	1898	1771	1771
query48	401	471	341	341
query49	788	564	483	483
query50	669	712	426	426
query51	5467	5663	5492	5492
query52	129	118	116	116
query53	249	282	210	210
query54	616	611	556	556
query55	95	97	95	95
query56	358	359	332	332
query57	1204	1239	1153	1153
query58	318	310	308	308
query59	2818	2779	2626	2626
query60	389	378	362	362
query61	151	147	153	147
query62	816	748	680	680
query63	248	225	221	221
query64	4330	1131	746	746
query65	4286	4183	4230	4183
query66	1234	606	517	517
query67	16008	15789	15474	15474
query68	8095	904	546	546
query69	505	343	310	310
query70	1278	1155	1165	1155
query71	482	348	344	344
query72	5572	4844	4691	4691
query73	728	712	376	376
query74	9157	9212	8720	8720
query75	3855	3157	2682	2682
query76	3621	1154	754	754
query77	860	469	394	394
query78	10021	10252	9481	9481
query79	2378	846	588	588
query80	713	583	526	526
query81	496	270	238	238
query82	461	147	122	122
query83	313	292	263	263
query84	305	115	93	93
query85	819	396	365	365
query86	363	327	313	313
query87	4498	4548	4388	4388
query88	2948	2390	2367	2367
query89	425	340	301	301
query90	1981	236	228	228
query91	156	162	130	130
query92	95	84	81	81
query93	1567	944	592	592
query94	704	398	309	309
query95	399	334	332	332
query96	487	603	292	292
query97	2704	2781	2664	2664
query98	254	230	226	226
query99	1473	1435	1290	1290
Total cold run time: 279492 ms
Total hot run time: 190515 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.07	0.04	0.04
query3	0.25	0.08	0.07
query4	1.62	0.11	0.11
query5	0.43	0.44	0.41
query6	1.16	0.65	0.67
query7	0.03	0.02	0.02
query8	0.05	0.04	0.03
query9	0.61	0.56	0.53
query10	0.60	0.59	0.59
query11	0.17	0.12	0.12
query12	0.16	0.13	0.13
query13	0.64	0.61	0.61
query14	0.79	0.81	0.82
query15	0.90	0.87	0.90
query16	0.39	0.39	0.40
query17	1.08	1.06	1.04
query18	0.22	0.21	0.21
query19	1.89	1.81	1.82
query20	0.02	0.02	0.01
query21	15.37	0.87	0.52
query22	0.77	1.32	0.76
query23	14.77	1.37	0.63
query24	6.98	1.45	0.58
query25	0.49	0.13	0.22
query26	0.58	0.17	0.15
query27	0.06	0.05	0.06
query28	9.37	0.93	0.44
query29	12.77	3.93	3.38
query30	3.18	3.12	3.10
query31	2.82	0.59	0.38
query32	3.24	0.55	0.48
query33	3.08	3.07	3.12
query34	16.15	5.42	4.87
query35	4.85	4.89	4.86
query36	0.69	0.51	0.51
query37	0.10	0.07	0.07
query38	0.06	0.05	0.04
query39	0.04	0.04	0.04
query40	0.18	0.15	0.15
query41	0.09	0.04	0.04
query42	0.05	0.03	0.04
query43	0.05	0.04	0.04
Total cold run time: 106.87 s
Total hot run time: 32.81 s

@Mryange
Copy link
Contributor Author

Mryange commented Jul 21, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17615	5244	5109	5109
q2	1955	307	199	199
q3	10261	1333	721	721
q4	10232	1041	524	524
q5	7514	2452	2386	2386
q6	196	174	142	142
q7	958	789	629	629
q8	9355	1376	1142	1142
q9	6860	5193	5195	5193
q10	6922	2411	1990	1990
q11	497	306	287	287
q12	353	378	236	236
q13	17769	3762	3189	3189
q14	239	249	233	233
q15	583	513	507	507
q16	439	454	408	408
q17	637	894	383	383
q18	7890	7296	7101	7101
q19	1254	1001	591	591
q20	367	367	258	258
q21	4242	3382	2473	2473
q22	1093	1067	1009	1009
Total cold run time: 107231 ms
Total hot run time: 34710 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5172	5109	5090	5090
q2	259	348	249	249
q3	2252	2809	2352	2352
q4	1379	1809	1376	1376
q5	4481	4537	4514	4514
q6	221	176	139	139
q7	2022	1986	1789	1789
q8	2613	2695	2713	2695
q9	7395	7363	7302	7302
q10	3156	3304	2887	2887
q11	612	538	509	509
q12	690	822	650	650
q13	3512	3985	3418	3418
q14	318	336	280	280
q15	563	513	509	509
q16	471	513	469	469
q17	1190	1545	1416	1416
q18	8050	7642	7568	7568
q19	846	841	947	841
q20	2052	2078	1974	1974
q21	4930	4668	4727	4668
q22	1196	1109	1093	1093
Total cold run time: 53380 ms
Total hot run time: 51788 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192108 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 650fbb9ccc41e953d761f1be844963e0fe9b38ce, data reload: false

query1	1018	403	421	403
query2	6562	1721	1685	1685
query3	6764	241	234	234
query4	26796	24135	23412	23412
query5	4474	759	564	564
query6	350	239	215	215
query7	4635	509	305	305
query8	369	312	299	299
query9	8609	2951	2944	2944
query10	516	364	302	302
query11	15666	15553	14901	14901
query12	172	128	124	124
query13	1677	551	438	438
query14	9795	6251	6240	6240
query15	221	197	181	181
query16	7608	658	484	484
query17	1227	725	605	605
query18	2043	436	343	343
query19	203	200	230	200
query20	142	136	133	133
query21	239	150	128	128
query22	4608	4777	4606	4606
query23	35084	34205	33473	33473
query24	8229	2468	2467	2467
query25	555	514	418	418
query26	1237	288	172	172
query27	2737	543	381	381
query28	4373	2191	2193	2191
query29	791	592	479	479
query30	305	236	207	207
query31	969	890	788	788
query32	118	84	84	84
query33	576	419	375	375
query34	829	870	558	558
query35	808	835	784	784
query36	994	1052	935	935
query37	139	116	97	97
query38	4223	4151	4113	4113
query39	1527	1485	1460	1460
query40	229	148	137	137
query41	153	105	106	105
query42	143	121	123	121
query43	506	543	465	465
query44	1364	881	877	877
query45	195	193	176	176
query46	860	1031	651	651
query47	1805	1863	1798	1798
query48	410	500	366	366
query49	807	609	485	485
query50	681	715	445	445
query51	5521	5603	5417	5417
query52	130	121	115	115
query53	258	288	220	220
query54	628	622	575	575
query55	97	101	103	101
query56	361	372	345	345
query57	1228	1238	1216	1216
query58	329	328	323	323
query59	2580	2712	2599	2599
query60	409	375	365	365
query61	156	150	157	150
query62	822	754	683	683
query63	252	220	225	220
query64	4391	1068	751	751
query65	4301	4266	4220	4220
query66	1261	620	531	531
query67	16042	16374	15631	15631
query68	8489	929	553	553
query69	508	366	335	335
query70	1238	1216	1088	1088
query71	483	386	368	368
query72	5290	4765	4803	4765
query73	743	637	379	379
query74	9073	9210	8742	8742
query75	3984	3159	2672	2672
query76	3726	1159	760	760
query77	868	479	421	421
query78	10091	10431	9302	9302
query79	1779	836	610	610
query80	779	625	551	551
query81	482	286	243	243
query82	440	151	125	125
query83	298	288	271	271
query84	261	117	102	102
query85	827	392	362	362
query86	381	324	309	309
query87	4485	4523	4412	4412
query88	3053	2494	2377	2377
query89	407	346	308	308
query90	1960	248	242	242
query91	164	167	127	127
query92	99	83	82	82
query93	1072	994	597	597
query94	700	417	321	321
query95	419	337	346	337
query96	517	611	293	293
query97	2784	2793	2690	2690
query98	292	231	233	231
query99	1481	1452	1317	1317
Total cold run time: 280280 ms
Total hot run time: 192108 ms

@Mryange
Copy link
Contributor Author

Mryange commented Jul 22, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17560	5258	5038	5038
q2	1921	275	191	191
q3	10322	1302	697	697
q4	10247	995	521	521
q5	7927	2412	2331	2331
q6	183	158	126	126
q7	873	743	612	612
q8	9322	1292	1067	1067
q9	6770	5130	5212	5130
q10	6879	2377	1970	1970
q11	481	301	285	285
q12	343	353	223	223
q13	17752	3684	3044	3044
q14	219	223	215	215
q15	550	479	475	475
q16	418	419	384	384
q17	581	851	347	347
q18	7614	7123	7094	7094
q19	1224	1090	560	560
q20	339	330	223	223
q21	3656	3156	2318	2318
q22	1079	1034	975	975
Total cold run time: 106260 ms
Total hot run time: 33826 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5106	5088	5072	5072
q2	241	348	224	224
q3	2129	2639	2290	2290
q4	1338	1788	1369	1369
q5	4197	4493	4430	4430
q6	209	171	130	130
q7	2019	1950	1787	1787
q8	2602	2549	2503	2503
q9	7334	7358	7288	7288
q10	3117	3330	2868	2868
q11	591	538	495	495
q12	672	765	645	645
q13	3450	4015	3348	3348
q14	313	319	276	276
q15	523	490	471	471
q16	443	505	465	465
q17	1183	1539	1420	1420
q18	7740	7738	7653	7653
q19	739	737	768	737
q20	1887	2015	1909	1909
q21	4861	4468	4368	4368
q22	1085	1063	1070	1063
Total cold run time: 51779 ms
Total hot run time: 50811 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 187995 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 650fbb9ccc41e953d761f1be844963e0fe9b38ce, data reload: false

query1	978	384	393	384
query2	6526	1682	1733	1682
query3	6754	226	223	223
query4	26629	23737	23016	23016
query5	4381	603	507	507
query6	317	214	202	202
query7	4639	485	291	291
query8	285	239	217	217
query9	8589	2899	2906	2899
query10	477	327	294	294
query11	15904	14962	14805	14805
query12	156	114	115	114
query13	1648	522	419	419
query14	8836	5854	5844	5844
query15	212	197	173	173
query16	7291	621	461	461
query17	1226	732	598	598
query18	1999	416	327	327
query19	198	188	166	166
query20	126	117	113	113
query21	223	127	114	114
query22	4403	4473	4235	4235
query23	34001	33424	33273	33273
query24	8136	2379	2404	2379
query25	552	469	413	413
query26	1232	267	163	163
query27	2735	544	365	365
query28	4311	2167	2130	2130
query29	757	607	445	445
query30	280	215	194	194
query31	910	831	769	769
query32	82	74	77	74
query33	550	369	323	323
query34	779	840	505	505
query35	826	826	726	726
query36	1021	1014	945	945
query37	113	101	82	82
query38	4129	4183	4096	4096
query39	1511	1453	1438	1438
query40	220	127	113	113
query41	62	56	55	55
query42	121	111	114	111
query43	492	489	467	467
query44	1339	846	854	846
query45	178	167	172	167
query46	830	1002	637	637
query47	1827	1861	1776	1776
query48	381	429	311	311
query49	731	492	406	406
query50	628	686	404	404
query51	5401	5568	5477	5477
query52	121	111	105	105
query53	229	256	190	190
query54	581	588	525	525
query55	99	86	99	86
query56	322	326	311	311
query57	1207	1224	1147	1147
query58	283	280	276	276
query59	2601	2665	2565	2565
query60	359	330	330	330
query61	166	122	121	121
query62	790	717	654	654
query63	217	191	187	187
query64	4280	1031	728	728
query65	4286	4209	4220	4209
query66	1173	413	339	339
query67	16006	15653	15500	15500
query68	8095	883	542	542
query69	477	329	288	288
query70	1179	1120	1109	1109
query71	461	327	302	302
query72	5729	4690	4669	4669
query73	723	585	359	359
query74	9316	8838	8881	8838
query75	3806	3104	2677	2677
query76	3689	1132	714	714
query77	793	380	334	334
query78	10050	10183	9385	9385
query79	2640	829	656	656
query80	605	531	483	483
query81	460	249	230	230
query82	456	142	105	105
query83	275	245	240	240
query84	295	104	90	90
query85	786	357	318	318
query86	339	321	282	282
query87	4418	4497	4310	4310
query88	3177	2378	2320	2320
query89	377	313	284	284
query90	1919	219	216	216
query91	150	135	111	111
query92	80	73	67	67
query93	1209	937	599	599
query94	680	414	293	293
query95	388	312	306	306
query96	490	590	286	286
query97	2767	2824	2661	2661
query98	247	221	214	214
query99	1439	1406	1260	1260
Total cold run time: 276167 ms
Total hot run time: 187995 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.08	0.05	0.04
query3	0.25	0.07	0.07
query4	1.62	0.11	0.11
query5	0.45	0.42	0.41
query6	1.18	0.65	0.67
query7	0.02	0.02	0.02
query8	0.05	0.04	0.03
query9	0.59	0.52	0.51
query10	0.58	0.57	0.56
query11	0.15	0.11	0.11
query12	0.15	0.12	0.12
query13	0.64	0.59	0.60
query14	0.80	0.83	0.80
query15	0.91	0.86	0.88
query16	0.39	0.38	0.39
query17	1.08	1.08	1.06
query18	0.23	0.22	0.22
query19	1.93	1.91	1.84
query20	0.03	0.01	0.01
query21	15.37	0.91	0.52
query22	0.77	1.15	0.67
query23	14.92	1.39	0.60
query24	6.72	1.15	0.81
query25	0.48	0.15	0.08
query26	0.61	0.18	0.14
query27	0.06	0.06	0.05
query28	9.95	0.96	0.43
query29	12.53	4.03	3.32
query30	3.07	2.98	3.02
query31	2.83	0.60	0.38
query32	3.22	0.56	0.47
query33	3.16	3.05	3.18
query34	15.75	5.54	4.85
query35	4.85	4.87	4.90
query36	0.68	0.50	0.48
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.03	0.02	0.02
query40	0.17	0.15	0.14
query41	0.08	0.03	0.02
query42	0.03	0.03	0.02
query43	0.04	0.03	0.02
Total cold run time: 106.63 s
Total hot run time: 32.44 s

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

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

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

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

}

// Handle the integer part
int start = (formatted_num[0] == '-') ? 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will formatted_num be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个formatted_num是fmt::format("{:.{}f}", value, decimal_places)的结果。
这个已经判断是一个正规的数了,变成字符串一定不为空,我加一个DCHECK吧。

@BiteTheDDDDt BiteTheDDDDt merged commit 4860c2d into apache:master Jul 22, 2025
26 of 31 checks passed
Mryange added a commit to Mryange/doris that referenced this pull request Jul 24, 2025
…pache#53660)

my_double_round did not handle NaN values correctly. For example, when
dec is very large and value is 0, there will be a case of 0 * inf,
resulting in a NaN value.
do_format_round assumes the input is always a valid double value, which
causes a core dump when a NaN is passed in.

Additionally,
(value.size() - (is_positive ? (decimal_places + 2) : (decimal_places +
3))) / 3;
This code does not account for the situation where value.size() is 0.

Currently, a custom add_thousands_separator function is implemented. If
the fmt library is upgraded in the future, we should use fmt to add
thousands separators.
Mryange added a commit to Mryange/doris that referenced this pull request Jul 24, 2025
…pache#53660)

my_double_round did not handle NaN values correctly. For example, when
dec is very large and value is 0, there will be a case of 0 * inf,
resulting in a NaN value.
do_format_round assumes the input is always a valid double value, which
causes a core dump when a NaN is passed in.

Additionally,
(value.size() - (is_positive ? (decimal_places + 2) : (decimal_places +
3))) / 3;
This code does not account for the situation where value.size() is 0.

Currently, a custom add_thousands_separator function is implemented. If
the fmt library is upgraded in the future, we should use fmt to add
thousands separators.
morrySnow pushed a commit that referenced this pull request Jul 25, 2025
w41ter pushed a commit to w41ter/incubator-doris that referenced this pull request Jul 30, 2025
…pache#53660)

my_double_round did not handle NaN values correctly. For example, when
dec is very large and value is 0, there will be a case of 0 * inf,
resulting in a NaN value.
do_format_round assumes the input is always a valid double value, which
causes a core dump when a NaN is passed in.

Additionally,
(value.size() - (is_positive ? (decimal_places + 2) : (decimal_places +
3))) / 3;
This code does not account for the situation where value.size() is 0.

Currently, a custom add_thousands_separator function is implemented. If
the fmt library is upgraded in the future, we should use fmt to add
thousands separators.
dataroaring pushed a commit that referenced this pull request Aug 1, 2025
…ons (#53855)

…53660)
#53660
my_double_round did not handle NaN values correctly. For example, when
dec is very large and value is 0, there will be a case of 0 * inf,
resulting in a NaN value.
do_format_round assumes the input is always a valid double value, which
causes a core dump when a NaN is passed in.

Additionally,
(value.size() - (is_positive ? (decimal_places + 2) : (decimal_places +
3))) / 3;
This code does not account for the situation where value.size() is 0.

Currently, a custom add_thousands_separator function is implemented. If
the fmt library is upgraded in the future, we should use fmt to add
thousands separators.

### 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
    - [ ] 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 <!-- 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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/3.0.7-merged dev/3.1.0-merged p0_c reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants