Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](function) MicroSecondsSub without scale #38945

Merged
merged 2 commits into from
Aug 10, 2024

Conversation

Mryange
Copy link
Contributor

@Mryange Mryange commented Aug 6, 2024

Proposed changes

Added the computeSignature function for millisecond/microsecond calculation functions to generate parameters and return values with the appropriate precision.
Modified the microSecondsAdd function, which was used for constant folding, because constant folding uses the precision of the parameters for calculation. However, for millisecond/microsecond calculations, it is necessary to set the precision to the maximum to ensure correct display.

before

mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+

now

mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+

@doris-robot
Copy link

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

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@Mryange
Copy link
Contributor Author

Mryange commented Aug 6, 2024

run buildall

@github-actions github-actions bot added the doing label Aug 6, 2024
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17666	4121	4073	4073
q2	2026	203	197	197
q3	10471	1383	1391	1383
q4	10184	815	898	815
q5	7644	2845	2955	2845
q6	218	136	138	136
q7	1060	621	608	608
q8	9433	1877	1922	1877
q9	8493	6592	6593	6592
q10	8736	3823	3834	3823
q11	438	248	256	248
q12	444	233	235	233
q13	17756	2960	2927	2927
q14	277	245	250	245
q15	516	488	493	488
q16	532	392	393	392
q17	970	922	901	901
q18	8034	7243	7278	7243
q19	1421	1216	1216	1216
q20	567	327	349	327
q21	5249	4696	4739	4696
q22	359	278	286	278
Total cold run time: 112494 ms
Total hot run time: 41543 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4090	4012	3991	3991
q2	328	220	221	220
q3	2972	3003	3113	3003
q4	2002	1977	2020	1977
q5	5552	5477	5489	5477
q6	226	131	130	130
q7	2107	1759	1835	1759
q8	3326	3363	3309	3309
q9	8688	8673	8713	8673
q10	3966	4046	3953	3953
q11	548	448	460	448
q12	787	603	602	602
q13	11592	3127	3097	3097
q14	309	280	278	278
q15	529	492	498	492
q16	449	420	421	420
q17	1749	1706	1715	1706
q18	8125	7782	7721	7721
q19	1749	1707	1705	1705
q20	2045	1853	1874	1853
q21	5865	5483	5379	5379
q22	513	454	454	454
Total cold run time: 67517 ms
Total hot run time: 56647 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 168125 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 2a47ae10b2391c75a1d870e0a72a4f37b3a0b0bf, data reload: false

query1	897	377	374	374
query2	6458	1747	1698	1698
query3	6885	209	219	209
query4	20362	17571	17261	17261
query5	3664	507	527	507
query6	275	198	165	165
query7	4588	298	294	294
query8	272	203	190	190
query9	8496	2386	2357	2357
query10	448	280	258	258
query11	10368	9932	9982	9932
query12	117	86	88	86
query13	1637	380	368	368
query14	9720	6167	6908	6167
query15	198	159	166	159
query16	6748	442	446	442
query17	924	537	545	537
query18	1322	297	282	282
query19	186	137	149	137
query20	94	86	85	85
query21	198	99	96	96
query22	4453	4075	3965	3965
query23	33635	33654	33442	33442
query24	9184	3073	3096	3073
query25	620	399	394	394
query26	731	148	152	148
query27	2214	283	282	282
query28	5742	2046	2016	2016
query29	812	440	438	438
query30	245	155	154	154
query31	936	753	787	753
query32	106	54	57	54
query33	643	308	314	308
query34	886	490	511	490
query35	885	777	805	777
query36	1064	901	904	901
query37	145	85	79	79
query38	3019	2839	2878	2839
query39	865	810	801	801
query40	196	112	111	111
query41	45	43	46	43
query42	121	98	99	98
query43	465	415	418	415
query44	1128	726	715	715
query45	210	175	176	175
query46	1081	803	773	773
query47	1827	1728	1742	1728
query48	369	287	292	287
query49	824	416	421	416
query50	893	435	430	430
query51	6689	6709	6604	6604
query52	102	91	90	90
query53	254	179	176	176
query54	618	456	454	454
query55	75	74	79	74
query56	264	250	256	250
query57	1106	1068	1042	1042
query58	277	318	279	279
query59	2636	2431	2410	2410
query60	283	286	275	275
query61	95	89	88	88
query62	857	654	641	641
query63	207	178	181	178
query64	4723	1898	1873	1873
query65	3160	3081	3075	3075
query66	921	320	330	320
query67	15304	14670	14850	14670
query68	4308	551	566	551
query69	443	311	314	311
query70	1103	1061	1115	1061
query71	382	286	287	286
query72	7101	2646	2446	2446
query73	759	329	328	328
query74	5972	5594	5628	5594
query75	3393	2746	2668	2668
query76	2176	1224	1272	1224
query77	416	313	308	308
query78	9403	8988	8862	8862
query79	1355	521	530	521
query80	982	513	498	498
query81	570	223	226	223
query82	1065	129	140	129
query83	231	169	168	168
query84	263	77	76	76
query85	1035	306	292	292
query86	388	304	297	297
query87	3257	3104	3099	3099
query88	2922	2411	2431	2411
query89	385	281	284	281
query90	1697	191	189	189
query91	123	99	100	99
query92	56	49	48	48
query93	1383	618	633	618
query94	749	289	296	289
query95	461	266	268	266
query96	607	278	282	278
query97	3196	3033	3050	3033
query98	220	206	192	192
query99	1619	1271	1294	1271
Total cold run time: 252792 ms
Total hot run time: 168125 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.07	0.04	0.05
query3	0.22	0.05	0.05
query4	1.68	0.07	0.07
query5	0.50	0.50	0.47
query6	1.16	0.71	0.72
query7	0.02	0.01	0.01
query8	0.05	0.04	0.04
query9	0.58	0.50	0.52
query10	0.57	0.57	0.57
query11	0.15	0.11	0.12
query12	0.14	0.12	0.12
query13	0.61	0.61	0.60
query14	0.78	0.81	0.81
query15	0.92	0.88	0.87
query16	0.36	0.35	0.37
query17	0.96	0.98	0.99
query18	0.22	0.22	0.21
query19	1.80	1.78	1.74
query20	0.01	0.00	0.01
query21	15.39	0.77	0.67
query22	4.27	8.24	1.18
query23	18.04	1.55	1.40
query24	2.26	0.22	0.22
query25	0.19	0.07	0.07
query26	0.32	0.22	0.22
query27	0.46	0.23	0.23
query28	13.17	1.01	0.97
query29	12.52	3.34	3.31
query30	0.25	0.06	0.05
query31	2.88	0.40	0.40
query32	3.26	0.51	0.48
query33	2.92	2.95	2.97
query34	15.45	4.30	4.28
query35	4.30	4.28	4.34
query36	0.68	0.47	0.49
query37	0.18	0.16	0.15
query38	0.16	0.16	0.15
query39	0.03	0.03	0.04
query40	0.16	0.13	0.12
query41	0.10	0.05	0.04
query42	0.05	0.05	0.04
query43	0.05	0.04	0.04
Total cold run time: 107.93 s
Total hot run time: 30.03 s

Copy link
Contributor

@zclllyybb zclllyybb left a comment

Choose a reason for hiding this comment

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

should add many testcases

@yiguolei yiguolei added dev/2.1.x and removed doing labels Aug 6, 2024
@Mryange
Copy link
Contributor Author

Mryange commented Aug 6, 2024

run buildall

@github-actions github-actions bot added the doing label Aug 6, 2024
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17687	4099	4020	4020
q2	2022	197	197	197
q3	10464	1181	1260	1181
q4	10173	812	886	812
q5	7639	2881	2955	2881
q6	219	141	138	138
q7	1056	610	609	609
q8	9432	1784	1927	1784
q9	8704	6574	6584	6574
q10	8722	3830	3846	3830
q11	425	246	252	246
q12	453	224	218	218
q13	17760	2933	2966	2933
q14	269	247	251	247
q15	519	481	502	481
q16	522	399	388	388
q17	958	920	875	875
q18	7962	7207	7149	7149
q19	1518	1221	1200	1200
q20	551	322	335	322
q21	5241	4653	4841	4653
q22	358	280	291	280
Total cold run time: 112654 ms
Total hot run time: 41018 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4091	4050	3962	3962
q2	327	228	215	215
q3	2972	2941	3076	2941
q4	2002	1971	2004	1971
q5	5500	5540	5434	5434
q6	219	134	131	131
q7	2102	1767	1785	1767
q8	3311	3377	3306	3306
q9	8654	8628	8661	8628
q10	3942	3995	3993	3993
q11	542	445	450	445
q12	725	582	579	579
q13	16528	3143	3105	3105
q14	298	261	275	261
q15	526	504	489	489
q16	466	432	419	419
q17	1714	1729	1724	1724
q18	8124	7812	7638	7638
q19	2464	1720	1695	1695
q20	2140	1883	1820	1820
q21	5682	5500	5246	5246
q22	535	467	481	467
Total cold run time: 72864 ms
Total hot run time: 56236 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 169904 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 50b46f7891e3e42bf752cd05df762093f7f36877, data reload: false

query1	907	360	367	360
query2	6468	1688	1660	1660
query3	6646	215	225	215
query4	20282	17391	17229	17229
query5	3646	519	517	517
query6	289	192	178	178
query7	4612	315	306	306
query8	253	194	188	188
query9	8530	2372	2370	2370
query10	437	285	268	268
query11	10488	10081	10161	10081
query12	115	88	84	84
query13	1600	396	366	366
query14	8182	7531	7443	7443
query15	201	164	169	164
query16	6798	430	472	430
query17	940	555	549	549
query18	1896	277	293	277
query19	192	171	155	155
query20	90	88	84	84
query21	198	98	93	93
query22	4200	4066	4063	4063
query23	33794	33848	33504	33504
query24	9252	3101	3074	3074
query25	665	398	398	398
query26	1068	151	150	150
query27	2289	282	294	282
query28	6878	2029	2018	2018
query29	1035	437	439	437
query30	239	154	153	153
query31	924	761	768	761
query32	103	52	52	52
query33	648	314	315	314
query34	935	482	488	482
query35	858	761	767	761
query36	1063	880	886	880
query37	191	82	83	82
query38	2959	2850	2847	2847
query39	905	802	815	802
query40	211	111	110	110
query41	44	44	46	44
query42	112	97	93	93
query43	450	437	423	423
query44	1170	713	723	713
query45	207	179	179	179
query46	1088	821	790	790
query47	1877	1738	1741	1738
query48	356	286	315	286
query49	849	439	417	417
query50	892	428	429	428
query51	6758	6649	6661	6649
query52	96	91	88	88
query53	247	189	176	176
query54	611	438	439	438
query55	73	73	75	73
query56	275	266	258	258
query57	1125	1060	1044	1044
query58	266	264	259	259
query59	2497	2345	2286	2286
query60	296	275	295	275
query61	96	94	109	94
query62	886	661	642	642
query63	211	186	183	183
query64	4608	1922	1842	1842
query65	3129	3084	3087	3084
query66	832	326	326	326
query67	15154	14845	14682	14682
query68	4348	564	568	564
query69	642	354	307	307
query70	1103	1070	1094	1070
query71	401	281	278	278
query72	7223	2763	2635	2635
query73	768	324	332	324
query74	6045	5656	5647	5647
query75	3402	2695	2702	2695
query76	2234	1209	1265	1209
query77	668	318	290	290
query78	9423	9002	8971	8971
query79	2566	527	535	527
query80	1106	520	500	500
query81	564	230	226	226
query82	731	136	134	134
query83	257	172	168	168
query84	265	75	77	75
query85	1659	316	298	298
query86	457	294	286	286
query87	3339	3094	3088	3088
query88	3835	2376	2414	2376
query89	384	287	292	287
query90	1745	188	186	186
query91	123	97	99	97
query92	58	50	48	48
query93	2300	612	618	612
query94	749	292	288	288
query95	377	263	265	263
query96	596	282	275	275
query97	3252	3065	3023	3023
query98	220	202	190	190
query99	1730	1270	1278	1270
Total cold run time: 257762 ms
Total hot run time: 169904 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.08	0.04	0.04
query3	0.23	0.04	0.04
query4	1.69	0.06	0.08
query5	0.48	0.47	0.49
query6	1.14	0.71	0.72
query7	0.02	0.01	0.01
query8	0.05	0.04	0.04
query9	0.58	0.52	0.53
query10	0.56	0.57	0.55
query11	0.15	0.12	0.12
query12	0.15	0.12	0.11
query13	0.61	0.60	0.59
query14	0.78	0.79	0.78
query15	0.90	0.87	0.85
query16	0.36	0.36	0.35
query17	0.98	0.96	0.99
query18	0.22	0.25	0.21
query19	1.82	1.74	1.72
query20	0.02	0.01	0.01
query21	15.41	0.75	0.66
query22	4.34	7.99	1.07
query23	17.92	1.35	1.34
query24	2.22	0.23	0.22
query25	0.18	0.08	0.08
query26	0.31	0.22	0.21
query27	0.46	0.23	0.24
query28	13.18	1.00	0.96
query29	12.53	3.29	3.30
query30	0.26	0.05	0.05
query31	2.88	0.41	0.41
query32	3.23	0.49	0.48
query33	2.91	2.98	2.95
query34	15.44	4.24	4.25
query35	4.30	4.28	4.27
query36	0.66	0.48	0.48
query37	0.20	0.16	0.17
query38	0.16	0.15	0.14
query39	0.04	0.04	0.03
query40	0.16	0.13	0.13
query41	0.10	0.04	0.04
query42	0.05	0.05	0.05
query43	0.04	0.04	0.04
Total cold run time: 107.84 s
Total hot run time: 29.71 s

@Mryange
Copy link
Contributor Author

Mryange commented Aug 7, 2024

run buildall

/**
* datetime arithmetic function microseconds-add.
*/
@ExecFunction(name = "microseconds_add", argTypes = {"DATETIMEV2", "INT"}, returnType = "DATETIMEV2")
Copy link
Contributor

Choose a reason for hiding this comment

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

restore this and make DateTimeV2Literal.plusMicroseconds always use MICRO pricision

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17638	4183	4092	4092
q2	2027	201	202	201
q3	10455	1360	1368	1360
q4	10172	772	979	772
q5	7640	3058	3006	3006
q6	224	140	136	136
q7	1066	631	614	614
q8	9437	1885	1971	1885
q9	8568	6633	6635	6633
q10	8791	3863	3894	3863
q11	434	247	248	247
q12	420	230	230	230
q13	17759	2952	2923	2923
q14	272	246	248	246
q15	530	490	493	490
q16	520	397	398	397
q17	984	959	936	936
q18	8053	7361	7309	7309
q19	1454	1240	1228	1228
q20	558	321	316	316
q21	5287	4779	4705	4705
q22	360	284	284	284
Total cold run time: 112649 ms
Total hot run time: 41873 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4080	4089	4051	4051
q2	335	228	220	220
q3	2993	3031	3182	3031
q4	1996	2053	1966	1966
q5	5644	5525	5467	5467
q6	223	131	131	131
q7	2143	1850	1839	1839
q8	3343	3374	3408	3374
q9	8661	8805	8776	8776
q10	4006	3939	3980	3939
q11	560	478	478	478
q12	789	622	592	592
q13	16306	3103	3112	3103
q14	304	266	273	266
q15	533	478	494	478
q16	472	422	420	420
q17	1796	1776	1775	1775
q18	8358	7737	7822	7737
q19	2412	1735	1763	1735
q20	2054	1866	1856	1856
q21	5754	5454	5286	5286
q22	538	469	483	469
Total cold run time: 73300 ms
Total hot run time: 56989 ms

@doris-robot
Copy link

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

query1	917	387	374	374
query2	6451	1725	1689	1689
query3	6663	213	219	213
query4	20182	17735	17264	17264
query5	3630	523	520	520
query6	279	212	174	174
query7	4588	299	290	290
query8	252	196	193	193
query9	8520	2331	2310	2310
query10	432	269	286	269
query11	10560	10020	10133	10020
query12	124	94	87	87
query13	1622	383	369	369
query14	9456	6272	6086	6086
query15	211	162	163	162
query16	6971	437	439	437
query17	968	594	560	560
query18	1887	289	291	289
query19	195	152	150	150
query20	95	85	88	85
query21	211	105	105	105
query22	4231	3963	4024	3963
query23	33895	34014	33491	33491
query24	10327	3173	3126	3126
query25	718	428	437	428
query26	1952	172	161	161
query27	3013	296	295	295
query28	7687	2015	1997	1997
query29	1380	490	455	455
query30	242	163	161	161
query31	941	791	788	788
query32	106	61	63	61
query33	709	359	332	332
query34	954	501	500	500
query35	880	786	764	764
query36	1055	886	868	868
query37	277	84	80	80
query38	2903	2820	2794	2794
query39	877	840	821	821
query40	296	118	114	114
query41	49	47	47	47
query42	121	102	100	100
query43	480	423	409	409
query44	1180	717	715	715
query45	215	180	177	177
query46	1084	831	817	817
query47	1847	1762	1758	1758
query48	375	291	288	288
query49	1027	439	442	439
query50	893	432	429	429
query51	6835	6654	6663	6654
query52	107	93	92	92
query53	251	185	180	180
query54	605	456	454	454
query55	76	74	76	74
query56	282	279	357	279
query57	1138	1059	1049	1049
query58	275	272	268	268
query59	2496	2364	2398	2364
query60	292	271	268	268
query61	97	96	134	96
query62	893	658	664	658
query63	209	182	182	182
query64	5698	1909	1924	1909
query65	3162	3104	3075	3075
query66	1309	337	331	331
query67	15498	14780	14865	14780
query68	8145	583	590	583
query69	757	386	340	340
query70	1151	1057	1034	1034
query71	534	284	282	282
query72	8134	2672	2514	2514
query73	978	325	322	322
query74	6073	5675	5621	5621
query75	4726	2746	2705	2705
query76	5704	1254	1291	1254
query77	934	306	311	306
query78	9633	8978	8999	8978
query79	3742	524	529	524
query80	963	495	497	495
query81	560	226	229	226
query82	743	130	133	130
query83	337	176	173	173
query84	267	78	130	78
query85	1411	314	325	314
query86	403	298	316	298
query87	3314	3102	3153	3102
query88	3886	2387	2403	2387
query89	447	300	286	286
query90	2001	193	193	193
query91	126	101	102	101
query92	59	51	55	51
query93	4517	632	625	625
query94	888	301	264	264
query95	371	261	267	261
query96	630	279	277	277
query97	3287	3058	3126	3058
query98	215	201	199	199
query99	1576	1277	1287	1277
Total cold run time: 279663 ms
Total hot run time: 168995 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.07	0.04	0.04
query3	0.23	0.05	0.04
query4	1.67	0.07	0.08
query5	0.48	0.48	0.48
query6	1.15	0.73	0.72
query7	0.02	0.02	0.01
query8	0.06	0.05	0.04
query9	0.56	0.51	0.50
query10	0.57	0.57	0.57
query11	0.15	0.12	0.11
query12	0.15	0.13	0.13
query13	0.62	0.62	0.60
query14	0.77	0.80	0.79
query15	0.90	0.88	0.87
query16	0.34	0.36	0.36
query17	1.01	0.99	1.02
query18	0.22	0.21	0.20
query19	1.84	1.75	1.71
query20	0.02	0.01	0.01
query21	15.42	0.76	0.64
query22	3.86	7.96	1.59
query23	18.09	1.36	1.39
query24	2.26	0.22	0.22
query25	0.17	0.08	0.08
query26	0.32	0.22	0.22
query27	0.47	0.23	0.23
query28	13.22	1.04	0.99
query29	14.18	3.33	3.29
query30	0.26	0.05	0.06
query31	2.87	0.41	0.41
query32	3.23	0.50	0.49
query33	2.94	2.92	3.00
query34	15.40	4.31	4.25
query35	4.27	4.30	4.27
query36	0.69	0.48	0.48
query37	0.19	0.16	0.16
query38	0.17	0.15	0.16
query39	0.04	0.03	0.04
query40	0.16	0.13	0.13
query41	0.10	0.04	0.04
query42	0.06	0.05	0.05
query43	0.05	0.04	0.04
Total cold run time: 109.3 s
Total hot run time: 30.37 s

@Mryange
Copy link
Contributor Author

Mryange commented Aug 7, 2024

run buildall

Copy link
Contributor

@zclllyybb zclllyybb left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

github-actions bot commented Aug 7, 2024

PR approved by anyone and no changes requested.

@doris-robot
Copy link

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

query1	918	380	361	361
query2	6498	1763	1748	1748
query3	6667	217	224	217
query4	20215	17358	17316	17316
query5	4275	514	542	514
query6	275	166	168	166
query7	4605	297	296	296
query8	250	195	183	183
query9	8509	2311	2305	2305
query10	426	270	275	270
query11	10281	10053	10138	10053
query12	142	87	86	86
query13	1616	393	372	372
query14	9329	7350	6763	6763
query15	203	164	165	164
query16	7101	503	446	446
query17	965	563	552	552
query18	1909	288	316	288
query19	194	150	147	147
query20	91	84	82	82
query21	204	97	95	95
query22	4155	4111	3957	3957
query23	33865	33228	33051	33051
query24	10423	3040	3039	3039
query25	664	377	383	377
query26	1783	149	149	149
query27	2936	273	270	270
query28	6911	1948	1926	1926
query29	1323	439	416	416
query30	283	148	147	147
query31	926	750	750	750
query32	98	55	54	54
query33	697	320	312	312
query34	901	479	477	477
query35	847	732	733	732
query36	994	872	865	865
query37	298	80	81	80
query38	2859	2759	2735	2735
query39	887	804	820	804
query40	283	112	110	110
query41	48	43	41	41
query42	123	95	104	95
query43	481	437	425	425
query44	1195	726	721	721
query45	205	179	208	179
query46	1079	812	774	774
query47	1818	1715	1728	1715
query48	362	286	293	286
query49	1192	421	427	421
query50	893	435	433	433
query51	6782	6674	6606	6606
query52	94	92	90	90
query53	262	182	177	177
query54	628	465	451	451
query55	75	75	76	75
query56	281	251	268	251
query57	1132	1045	1047	1045
query58	292	281	276	276
query59	2483	2451	2548	2451
query60	279	306	288	288
query61	100	95	96	95
query62	899	664	692	664
query63	211	180	180	180
query64	5838	1923	1884	1884
query65	3168	3109	3082	3082
query66	1468	336	329	329
query67	15223	14711	15089	14711
query68	4333	573	586	573
query69	446	299	312	299
query70	1108	1078	1073	1073
query71	418	278	282	278
query72	7033	2705	2485	2485
query73	759	333	333	333
query74	5950	5674	5540	5540
query75	3384	2708	2745	2708
query76	2426	1219	1257	1219
query77	436	313	317	313
query78	9424	9006	8843	8843
query79	1350	522	542	522
query80	1014	507	498	498
query81	573	227	228	227
query82	1059	141	136	136
query83	239	219	167	167
query84	275	89	80	80
query85	1300	320	303	303
query86	394	290	283	283
query87	3232	3047	3080	3047
query88	2925	2423	2394	2394
query89	385	283	288	283
query90	1791	193	193	193
query91	126	103	104	103
query92	62	53	56	53
query93	1396	615	618	615
query94	896	296	292	292
query95	401	265	266	265
query96	597	279	279	279
query97	3221	3077	3055	3055
query98	215	194	199	194
query99	1595	1288	1274	1274
Total cold run time: 261180 ms
Total hot run time: 168347 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.03
query2	0.07	0.04	0.04
query3	0.22	0.05	0.05
query4	1.69	0.07	0.07
query5	0.49	0.48	0.48
query6	1.13	0.72	0.72
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.58	0.54	0.52
query10	0.56	0.57	0.56
query11	0.15	0.12	0.13
query12	0.15	0.12	0.12
query13	0.61	0.60	0.60
query14	0.77	0.79	0.79
query15	0.89	0.86	0.86
query16	0.36	0.36	0.36
query17	0.98	1.04	0.98
query18	0.22	0.21	0.21
query19	1.85	1.74	1.74
query20	0.01	0.03	0.01
query21	15.39	0.74	0.66
query22	3.94	7.16	1.18
query23	17.96	1.43	1.37
query24	2.28	0.22	0.22
query25	0.19	0.08	0.07
query26	0.32	0.22	0.22
query27	0.46	0.23	0.23
query28	13.16	1.01	0.97
query29	12.76	3.28	3.25
query30	0.26	0.06	0.06
query31	2.86	0.41	0.41
query32	3.24	0.51	0.49
query33	2.91	2.98	2.94
query34	15.43	4.29	4.28
query35	4.30	4.30	4.30
query36	0.67	0.48	0.47
query37	0.19	0.17	0.16
query38	0.17	0.16	0.15
query39	0.04	0.04	0.04
query40	0.16	0.14	0.12
query41	0.10	0.06	0.05
query42	0.06	0.05	0.05
query43	0.05	0.03	0.03
Total cold run time: 107.75 s
Total hot run time: 30.03 s

@Mryange
Copy link
Contributor Author

Mryange commented Aug 7, 2024

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17667	4162	4108	4108
q2	2028	177	185	177
q3	10501	1250	1309	1250
q4	10168	862	974	862
q5	7551	2896	2895	2895
q6	221	138	138	138
q7	1041	607	622	607
q8	9441	1858	1955	1858
q9	8542	6622	6636	6622
q10	7054	2486	2484	2484
q11	441	251	268	251
q12	405	231	227	227
q13	17784	3012	2930	2930
q14	268	240	247	240
q15	529	484	475	475
q16	519	408	400	400
q17	981	950	939	939
q18	8088	7399	7313	7313
q19	1397	1222	1224	1222
q20	582	324	343	324
q21	5389	4825	4778	4778
q22	1102	973	976	973
Total cold run time: 111699 ms
Total hot run time: 41073 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4096	4136	4022	4022
q2	333	228	228	228
q3	2836	2823	2842	2823
q4	2029	2002	2051	2002
q5	5523	5568	5457	5457
q6	220	133	133	133
q7	2138	1683	1683	1683
q8	3337	3417	3367	3367
q9	8692	8672	8725	8672
q10	3479	3482	3487	3482
q11	561	455	450	450
q12	792	629	583	583
q13	16253	3135	3120	3120
q14	308	274	259	259
q15	536	486	487	486
q16	465	423	426	423
q17	1788	1819	1768	1768
q18	8224	7713	7585	7585
q19	2038	1742	1746	1742
q20	2062	1860	1845	1845
q21	5913	5467	5511	5467
q22	1083	972	999	972
Total cold run time: 72706 ms
Total hot run time: 56569 ms

@zclllyybb
Copy link
Contributor

run performance

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17662	4374	4231	4231
q2	2024	174	178	174
q3	10488	1207	1102	1102
q4	10129	766	700	700
q5	7493	2537	2503	2503
q6	227	143	139	139
q7	965	609	594	594
q8	9227	1918	1884	1884
q9	8852	6571	6566	6566
q10	7097	2246	2182	2182
q11	439	253	247	247
q12	385	222	222	222
q13	17928	3040	3033	3033
q14	281	243	245	243
q15	527	516	485	485
q16	497	389	387	387
q17	978	761	697	697
q18	8016	7538	7466	7466
q19	5253	1098	1075	1075
q20	697	340	342	340
q21	5376	4594	4776	4594
q22	1153	1061	997	997
Total cold run time: 115694 ms
Total hot run time: 39861 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4526	4322	4282	4282
q2	380	278	280	278
q3	2865	2700	2825	2700
q4	2061	1770	1786	1770
q5	5663	5718	5654	5654
q6	226	138	136	136
q7	2228	1932	1942	1932
q8	3375	3512	3515	3512
q9	9033	9171	8973	8973
q10	3630	3372	3225	3225
q11	603	495	505	495
q12	864	701	656	656
q13	17519	3229	3199	3199
q14	323	298	302	298
q15	533	509	501	501
q16	501	433	416	416
q17	1810	1571	1554	1554
q18	8042	7913	7881	7881
q19	1726	1499	1645	1499
q20	2140	1902	1891	1891
q21	7619	5421	5152	5152
q22	1120	1065	1104	1065
Total cold run time: 76787 ms
Total hot run time: 57069 ms

@yiguolei yiguolei added the p0_b label Aug 8, 2024
@zhiqiang-hhhh
Copy link
Contributor

run performance

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17692	4474	4309	4309
q2	2014	173	179	173
q3	10574	1152	1227	1152
q4	10174	785	768	768
q5	7500	2570	2589	2570
q6	223	140	139	139
q7	959	604	584	584
q8	9219	1936	1967	1936
q9	8737	6564	6539	6539
q10	7066	2231	2176	2176
q11	460	243	239	239
q12	400	217	218	217
q13	17774	3017	2976	2976
q14	270	229	234	229
q15	528	484	495	484
q16	506	393	390	390
q17	972	741	756	741
q18	8155	7607	7340	7340
q19	4659	1015	954	954
q20	660	329	331	329
q21	5225	4518	4347	4347
q22	1101	1038	1019	1019
Total cold run time: 114868 ms
Total hot run time: 39611 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4434	4251	4253	4251
q2	388	275	273	273
q3	2836	2610	2677	2610
q4	2009	1699	1711	1699
q5	5547	5517	5451	5451
q6	238	140	131	131
q7	2120	1764	1767	1764
q8	3309	3467	3464	3464
q9	8712	8720	8886	8720
q10	3493	3295	3362	3295
q11	600	483	502	483
q12	802	616	598	598
q13	15828	3171	3214	3171
q14	310	282	305	282
q15	541	481	497	481
q16	510	443	470	443
q17	1838	1530	1519	1519
q18	8205	8076	7934	7934
q19	1730	1571	1567	1567
q20	2134	1901	1870	1870
q21	15122	5368	5456	5368
q22	1119	1027	1018	1018
Total cold run time: 81825 ms
Total hot run time: 56392 ms

@doris-robot
Copy link

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

query1	908	377	350	350
query2	6431	1878	1835	1835
query3	6637	209	217	209
query4	29204	23407	23029	23029
query5	3627	489	489	489
query6	271	171	164	164
query7	4581	291	287	287
query8	245	205	192	192
query9	8651	2397	2368	2368
query10	561	440	465	440
query11	17802	15048	14887	14887
query12	129	98	102	98
query13	1637	395	357	357
query14	10236	7577	7535	7535
query15	245	203	211	203
query16	7292	515	447	447
query17	1306	537	530	530
query18	1754	288	274	274
query19	188	138	136	136
query20	111	100	103	100
query21	209	101	101	101
query22	4194	4676	4466	4466
query23	34333	33449	33564	33449
query24	7850	2589	2623	2589
query25	578	389	377	377
query26	725	167	159	159
query27	2382	290	287	287
query28	6184	2058	2019	2019
query29	779	413	400	400
query30	253	147	148	147
query31	948	747	739	739
query32	91	53	52	52
query33	575	268	271	268
query34	850	451	455	451
query35	945	835	767	767
query36	1086	903	929	903
query37	131	77	77	77
query38	4236	4195	4112	4112
query39	1456	1354	1382	1354
query40	198	114	113	113
query41	45	46	44	44
query42	112	94	93	93
query43	496	449	468	449
query44	1047	729	749	729
query45	229	207	208	207
query46	1084	775	709	709
query47	1888	1806	1761	1761
query48	370	293	305	293
query49	825	413	419	413
query50	814	429	399	399
query51	6796	6689	6713	6689
query52	99	87	84	84
query53	252	172	173	172
query54	635	446	433	433
query55	76	74	73	73
query56	264	232	241	232
query57	1143	1081	1043	1043
query58	220	220	228	220
query59	2937	2588	2718	2588
query60	290	257	275	257
query61	96	93	94	93
query62	760	640	641	640
query63	201	178	179	178
query64	9161	2248	1769	1769
query65	3164	3134	3114	3114
query66	768	326	324	324
query67	15226	14801	14692	14692
query68	5586	531	556	531
query69	384	378	374	374
query70	1220	1111	1133	1111
query71	446	275	274	274
query72	18753	16347	16058	16058
query73	792	330	325	325
query74	9205	8800	8701	8701
query75	3492	2612	2683	2612
query76	3159	996	956	956
query77	644	321	309	309
query78	9595	9005	8819	8819
query79	2236	515	509	509
query80	1923	489	486	486
query81	587	218	220	218
query82	776	127	131	127
query83	264	141	141	141
query84	266	81	74	74
query85	1297	268	272	268
query86	445	342	302	302
query87	4745	4500	4613	4500
query88	3548	2461	2485	2461
query89	397	284	281	281
query90	1783	201	187	187
query91	120	93	93	93
query92	56	48	48	48
query93	2228	537	530	530
query94	830	279	290	279
query95	352	256	255	255
query96	594	271	271	271
query97	3253	3040	3057	3040
query98	240	211	203	203
query99	1558	1281	1268	1268
Total cold run time: 299591 ms
Total hot run time: 200069 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.08	0.04	0.04
query3	0.22	0.05	0.05
query4	1.68	0.08	0.07
query5	0.49	0.50	0.48
query6	1.14	0.73	0.72
query7	0.02	0.02	0.01
query8	0.04	0.04	0.04
query9	0.54	0.48	0.48
query10	0.55	0.55	0.55
query11	0.15	0.11	0.11
query12	0.14	0.12	0.12
query13	0.60	0.60	0.59
query14	0.78	0.77	0.79
query15	0.83	0.80	0.82
query16	0.36	0.37	0.37
query17	1.03	1.04	1.05
query18	0.23	0.21	0.21
query19	1.79	1.81	1.79
query20	0.02	0.01	0.03
query21	15.39	0.74	0.66
query22	4.84	7.71	1.60
query23	18.27	1.34	1.26
query24	2.14	0.24	0.21
query25	0.16	0.08	0.08
query26	0.31	0.22	0.20
query27	0.45	0.23	0.22
query28	13.25	1.01	1.00
query29	12.64	3.37	3.33
query30	0.24	0.06	0.05
query31	2.88	0.39	0.38
query32	3.28	0.49	0.46
query33	2.88	2.89	2.83
query34	16.78	4.33	4.33
query35	4.38	4.39	4.37
query36	0.65	0.48	0.50
query37	0.18	0.16	0.16
query38	0.15	0.15	0.14
query39	0.04	0.04	0.04
query40	0.15	0.12	0.12
query41	0.09	0.05	0.06
query42	0.06	0.05	0.05
query43	0.05	0.04	0.04
Total cold run time: 110 s
Total hot run time: 30.35 s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 10, 2024
Copy link
Contributor

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

@yiguolei yiguolei merged commit a1ba0a1 into apache:master Aug 10, 2024
30 checks passed
Mryange added a commit to Mryange/doris that referenced this pull request Aug 10, 2024
## Proposed changes
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```


<!--Describe your changes.-->
Mryange added a commit to Mryange/doris that referenced this pull request Aug 10, 2024
## Proposed changes
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```


<!--Describe your changes.-->
dataroaring pushed a commit that referenced this pull request Aug 11, 2024
## Proposed changes
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```


<!--Describe your changes.-->
yiguolei pushed a commit that referenced this pull request Aug 12, 2024
## Proposed changes
#38945
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```


<!--Describe your changes.-->

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Aug 14, 2024
## Proposed changes
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```


<!--Describe your changes.-->
dataroaring pushed a commit that referenced this pull request Aug 16, 2024
## Proposed changes
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```


<!--Describe your changes.-->
HappenLee pushed a commit that referenced this pull request Aug 23, 2024
#38945
Added the computeSignature function for millisecond/microsecond
calculation functions to generate parameters and return values with the
appropriate precision.
Modified the microSecondsAdd function, which was used for constant
folding, because constant folding uses the precision of the parameters
for calculation. However, for millisecond/microsecond calculations, it
is necessary to set the precision to the maximum to ensure correct
display.


before
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49                                               |
+-------------------------------------------------------------------+
```
now
```
mysql> SELECT MICROSECONDS_SUB('2010-11-30 23:50:50', 2);
+-------------------------------------------------------------------+
| microseconds_sub(cast('2010-11-30 23:50:50' as DATETIMEV2(0)), 2) |
+-------------------------------------------------------------------+
| 2010-11-30 23:50:49.999998                                        |
+-------------------------------------------------------------------+
```
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/2.1.6-merged dev/3.0.2-merged doing p0_b reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants