Skip to content

[fix](function)timediff with now function causes a error signature (…#39347

Merged
HappenLee merged 2 commits intoapache:branch-2.0from
Mryange:branch-2.0-pic39322
Aug 23, 2024
Merged

[fix](function)timediff with now function causes a error signature (…#39347
HappenLee merged 2 commits intoapache:branch-2.0from
Mryange:branch-2.0-pic39322

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented Aug 14, 2024

#39322)
#39322
The derivation of precision for the datetime constant in version 2.0 is incorrect, it tends to be derived as the maximum precision.

mysql [(none)]>select round(timediff(now(),'2024-08-15')/60/60,2);
ERROR 1105 (HY000): errCode = 2, detailMessage = argument 1 requires datetimev2 type, however 'now()' is of datetime type

The reason is that the function parameter types were modified in expectedInputTypes, which led to no match being found. The code here is from a long time ago. Because the precision of datetimev2 could not be deduced in the past, a separate implementation was made here. This code can be safely deleted.

Proposed changes

Issue Number: close #xxx

…pache#39322)

```
mysql [(none)]>select round(timediff(now(),'2024-08-15')/60/60,2);
ERROR 1105 (HY000): errCode = 2, detailMessage = argument 1 requires datetimev2 type, however 'now()' is of datetime type
```
The reason is that the function parameter types were modified in
expectedInputTypes, which led to no match being found. The code here is
from a long time ago. Because the precision of datetimev2 could not be
deduced in the past, a separate implementation was made here. This code
can be safely deleted.

<!--Describe your changes.-->
@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 14, 2024

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17835	4416	4328	4328
q2	2063	157	149	149
q3	10343	1865	1930	1865
q4	10327	1218	1313	1218
q5	8490	3912	3870	3870
q6	229	125	125	125
q7	2043	1595	1609	1595
q8	9510	2729	2707	2707
q9	10657	10360	10256	10256
q10	8616	3534	3479	3479
q11	430	239	256	239
q12	466	301	299	299
q13	18350	3975	4005	3975
q14	355	336	323	323
q15	507	460	457	457
q16	689	581	585	581
q17	1130	990	961	961
q18	7263	6916	6815	6815
q19	1681	1533	1544	1533
q20	544	338	321	321
q21	4478	4102	4089	4089
q22	507	401	406	401
Total cold run time: 116513 ms
Total hot run time: 49586 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4316	4283	4326	4283
q2	321	230	230	230
q3	4156	4160	4138	4138
q4	2746	2761	2749	2749
q5	7205	7127	7183	7127
q6	236	117	118	117
q7	3280	2857	2813	2813
q8	4366	4471	4518	4471
q9	16916	16783	16744	16744
q10	4233	4282	4226	4226
q11	765	665	698	665
q12	1030	855	847	847
q13	6842	3733	3723	3723
q14	449	425	414	414
q15	499	451	465	451
q16	722	694	694	694
q17	3830	3829	3914	3829
q18	8770	8776	8706	8706
q19	1694	1696	1622	1622
q20	2356	2118	2134	2118
q21	8451	8463	8484	8463
q22	1036	984	950	950
Total cold run time: 84219 ms
Total hot run time: 79380 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 204700 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 556730444df0df8f6d71583d410670ab8e7be766, data reload: false

query1	931	393	439	393
query2	6523	2209	2192	2192
query3	6924	208	207	207
query4	20198	18090	18116	18090
query5	19736	6517	6535	6517
query6	283	217	243	217
query7	4157	310	302	302
query8	248	271	255	255
query9	3190	2742	2668	2668
query10	412	310	285	285
query11	11356	10805	10729	10729
query12	125	83	72	72
query13	5598	668	633	633
query14	17881	13392	13392	13392
query15	358	218	229	218
query16	6493	286	262	262
query17	1730	1433	890	890
query18	2298	416	416	416
query19	211	151	149	149
query20	79	76	78	76
query21	192	102	97	97
query22	5161	4889	4955	4889
query23	32465	31940	31898	31898
query24	6994	6512	6524	6512
query25	525	431	450	431
query26	525	161	167	161
query27	1889	301	293	293
query28	6136	2303	2274	2274
query29	2858	2612	2820	2612
query30	242	169	165	165
query31	908	728	779	728
query32	72	65	60	60
query33	411	250	256	250
query34	859	464	481	464
query35	1134	918	906	906
query36	1345	1178	1215	1178
query37	90	63	61	61
query38	3091	2930	2954	2930
query39	1349	1337	1317	1317
query40	204	94	95	94
query41	39	37	36	36
query42	83	82	82	82
query43	588	578	631	578
query44	1132	715	716	715
query45	247	230	232	230
query46	1219	955	974	955
query47	2154	1812	1617	1617
query48	978	683	681	681
query49	622	385	377	377
query50	862	577	623	577
query51	4725	4725	4714	4714
query52	83	85	78	78
query53	448	325	326	325
query54	2674	2450	2421	2421
query55	90	77	81	77
query56	219	204	204	204
query57	1172	1166	1086	1086
query58	218	221	199	199
query59	3330	3377	3242	3242
query60	216	195	193	193
query61	97	100	99	99
query62	887	517	461	461
query63	486	343	339	339
query64	2443	1551	1452	1452
query65	3639	3555	3582	3555
query66	829	383	379	379
query67	16896	15433	16216	15433
query68	9899	670	655	655
query69	573	348	348	348
query70	1604	1416	1628	1416
query71	418	316	329	316
query72	6517	3472	3465	3465
query73	739	317	325	317
query74	6407	5902	5837	5837
query75	5301	3653	3733	3653
query76	6078	1170	1220	1170
query77	1040	252	250	250
query78	12609	14786	14180	14180
query79	9353	633	637	633
query80	890	402	407	402
query81	500	241	236	236
query82	244	96	95	95
query83	175	137	131	131
query84	271	71	72	71
query85	775	320	314	314
query86	337	290	317	290
query87	3289	3011	3051	3011
query88	4793	2293	2293	2293
query89	351	291	287	287
query90	2660	190	208	190
query91	164	129	122	122
query92	61	51	48	48
query93	1008	566	544	544
query94	1180	210	213	210
query95	1118	1059	1067	1059
query96	636	326	326	326
query97	6428	6405	6379	6379
query98	196	173	173	173
query99	3038	896	891	891
Total cold run time: 310209 ms
Total hot run time: 204700 ms

@doris-robot
Copy link

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

query1	0.02	0.02	0.02
query2	0.08	0.03	0.02
query3	0.24	0.06	0.04
query4	1.78	0.06	0.06
query5	0.54	0.55	0.52
query6	1.25	0.61	0.60
query7	0.02	0.01	0.01
query8	0.03	0.03	0.02
query9	0.53	0.48	0.47
query10	0.54	0.54	0.54
query11	0.12	0.08	0.08
query12	0.12	0.10	0.09
query13	0.63	0.63	0.61
query14	0.79	0.78	0.79
query15	0.79	0.77	0.76
query16	0.39	0.36	0.36
query17	1.03	1.01	0.99
query18	0.23	0.24	0.24
query19	1.95	1.84	1.84
query20	0.01	0.00	0.01
query21	15.44	0.58	0.56
query22	2.06	2.85	1.50
query23	17.10	1.12	1.11
query24	6.06	1.50	1.14
query25	0.39	0.10	0.07
query26	0.68	0.15	0.15
query27	0.04	0.04	0.03
query28	6.73	0.75	0.73
query29	12.65	2.33	2.34
query30	0.61	0.54	0.53
query31	2.80	0.38	0.37
query32	3.41	0.51	0.50
query33	3.07	3.06	3.07
query34	15.24	4.74	4.78
query35	4.88	4.83	4.84
query36	1.05	1.02	1.02
query37	0.06	0.04	0.04
query38	0.03	0.02	0.02
query39	0.03	0.01	0.02
query40	0.16	0.15	0.14
query41	0.06	0.01	0.02
query42	0.02	0.02	0.01
query43	0.02	0.02	0.01
Total cold run time: 103.68 s
Total hot run time: 30.96 s

@doris-robot
Copy link

Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'

Load test result on commit 556730444df0df8f6d71583d410670ab8e7be766 with default session variables
Stream load json:         20 seconds loaded 2358488459 Bytes, about 112 MB/s
Stream load orc:          58 seconds loaded 1101869774 Bytes, about 18 MB/s
Stream load parquet:      31 seconds loaded 861443392 Bytes, about 26 MB/s
Insert into select:       21.1 seconds inserted 10000000 Rows, about 473K ops/s

@Mryange Mryange marked this pull request as draft August 14, 2024 10:48
@Mryange
Copy link
Contributor Author

Mryange commented Aug 14, 2024

run buildall

@Mryange Mryange marked this pull request as ready for review August 14, 2024 10:59
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17839	4391	4326	4326
q2	2069	155	149	149
q3	10503	1930	1951	1930
q4	10359	1247	1337	1247
q5	8338	3942	3972	3942
q6	232	125	122	122
q7	2026	1586	1599	1586
q8	9508	2739	2781	2739
q9	14292	10533	10483	10483
q10	8662	3531	3507	3507
q11	415	253	256	253
q12	469	293	292	292
q13	18352	3973	4109	3973
q14	352	341	322	322
q15	517	454	455	454
q16	662	572	572	572
q17	1141	936	963	936
q18	7290	7037	6812	6812
q19	1666	1594	1542	1542
q20	550	316	300	300
q21	4402	4124	4099	4099
q22	498	394	398	394
Total cold run time: 120142 ms
Total hot run time: 49980 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4276	4288	4301	4288
q2	320	226	233	226
q3	4168	4145	4148	4145
q4	2740	2761	2749	2749
q5	7212	7177	7181	7177
q6	240	115	119	115
q7	3272	2860	2846	2846
q8	4357	4496	4482	4482
q9	17483	17076	17157	17076
q10	4218	4304	4223	4223
q11	766	694	674	674
q12	1027	866	863	863
q13	7067	3788	3742	3742
q14	460	431	425	425
q15	511	465	467	465
q16	739	673	678	673
q17	3761	3899	3867	3867
q18	8941	8708	8769	8708
q19	1736	1727	1683	1683
q20	2447	2142	2107	2107
q21	8453	8446	8523	8446
q22	1057	1000	907	907
Total cold run time: 85251 ms
Total hot run time: 79887 ms

@doris-robot
Copy link

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

query1	933	391	412	391
query2	6559	2212	2129	2129
query3	6924	207	205	205
query4	20000	17982	18027	17982
query5	19720	6534	6549	6534
query6	288	228	225	225
query7	4159	303	305	303
query8	275	285	266	266
query9	3197	2754	2659	2659
query10	424	312	306	306
query11	11423	10821	10877	10821
query12	125	80	73	73
query13	5599	665	662	662
query14	17668	13548	13825	13548
query15	361	224	227	224
query16	6480	300	261	261
query17	1688	1464	863	863
query18	2335	405	408	405
query19	219	150	150	150
query20	77	76	84	76
query21	191	104	94	94
query22	5147	5074	5101	5074
query23	32523	31904	32048	31904
query24	6977	6533	6499	6499
query25	528	431	428	428
query26	528	160	163	160
query27	1882	295	300	295
query28	6097	2311	2277	2277
query29	2979	2822	2713	2713
query30	246	171	170	170
query31	941	738	751	738
query32	72	64	63	63
query33	402	267	257	257
query34	848	482	469	469
query35	1141	979	964	964
query36	1361	1210	1192	1192
query37	88	61	59	59
query38	3059	2910	2913	2910
query39	1364	1319	1318	1318
query40	208	104	96	96
query41	38	39	36	36
query42	80	93	84	84
query43	627	565	598	565
query44	1129	723	728	723
query45	239	227	230	227
query46	1222	980	976	976
query47	1845	1875	1891	1875
query48	968	681	652	652
query49	612	368	367	367
query50	859	612	620	612
query51	4791	4658	4643	4643
query52	100	93	86	86
query53	449	326	310	310
query54	2649	2461	2476	2461
query55	79	86	84	84
query56	239	217	224	217
query57	1195	1027	1022	1022
query58	216	207	196	196
query59	3707	3103	3279	3103
query60	218	206	216	206
query61	101	97	104	97
query62	783	438	475	438
query63	487	333	336	333
query64	2565	1550	1480	1480
query65	3646	3567	3578	3567
query66	795	383	394	383
query67	15779	17555	15339	15339
query68	8665	650	657	650
query69	564	359	345	345
query70	1434	1438	1348	1348
query71	413	299	327	299
query72	6553	3496	3509	3496
query73	747	328	322	322
query74	6360	5940	5885	5885
query75	5243	3745	3751	3745
query76	5243	1143	1224	1143
query77	884	264	259	259
query78	12688	11714	11606	11606
query79	7484	672	657	657
query80	1085	419	415	415
query81	498	247	236	236
query82	1669	100	99	99
query83	188	138	139	138
query84	267	73	74	73
query85	890	339	330	330
query86	332	292	300	292
query87	3241	3069	3029	3029
query88	4842	2320	2329	2320
query89	397	317	293	293
query90	1948	218	213	213
query91	157	131	126	126
query92	60	57	56	56
query93	5549	597	591	591
query94	707	218	213	213
query95	1127	1089	1084	1084
query96	637	323	324	323
query97	6557	6432	6488	6432
query98	185	174	168	168
query99	2920	820	880	820
Total cold run time: 309988 ms
Total hot run time: 202851 ms

@doris-robot
Copy link

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

query1	0.02	0.02	0.03
query2	0.07	0.03	0.02
query3	0.25	0.05	0.05
query4	1.80	0.07	0.06
query5	0.54	0.53	0.53
query6	1.25	0.62	0.60
query7	0.01	0.01	0.01
query8	0.03	0.02	0.02
query9	0.53	0.49	0.48
query10	0.55	0.55	0.53
query11	0.12	0.09	0.09
query12	0.11	0.10	0.09
query13	0.63	0.62	0.61
query14	0.78	0.79	0.79
query15	0.79	0.77	0.76
query16	0.36	0.37	0.36
query17	1.02	1.02	1.02
query18	0.22	0.25	0.24
query19	1.94	1.85	1.84
query20	0.02	0.01	0.01
query21	15.44	0.57	0.56
query22	1.92	1.90	1.68
query23	17.20	1.12	0.99
query24	5.87	1.07	1.34
query25	0.39	0.12	0.05
query26	0.67	0.15	0.17
query27	0.04	0.04	0.03
query28	6.86	0.74	0.75
query29	12.77	2.35	2.32
query30	0.61	0.54	0.52
query31	2.82	0.39	0.37
query32	3.39	0.50	0.49
query33	3.11	3.08	3.12
query34	15.28	4.81	4.82
query35	4.85	4.85	4.84
query36	1.08	1.02	1.03
query37	0.06	0.05	0.04
query38	0.04	0.02	0.02
query39	0.02	0.01	0.02
query40	0.15	0.14	0.14
query41	0.07	0.02	0.01
query42	0.02	0.02	0.01
query43	0.02	0.01	0.02
Total cold run time: 103.72 s
Total hot run time: 31.09 s

@doris-robot
Copy link

Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'

Load test result on commit d5057bc8b36ed643219291f0d9f5007ecdb9630f with default session variables
Stream load json:         20 seconds loaded 2358488459 Bytes, about 112 MB/s
Stream load orc:          58 seconds loaded 1101869774 Bytes, about 18 MB/s
Stream load parquet:      31 seconds loaded 861443392 Bytes, about 26 MB/s
Insert into select:       21.4 seconds inserted 10000000 Rows, about 467K ops/s

@HappenLee HappenLee merged commit d7b39da into apache:branch-2.0 Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants