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) fix wrong result when convert_tz is out of bound #37358

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

zclllyybb
Copy link
Contributor

Proposed changes

Issue Number: close #xxx

before:

mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-31 08:01:19                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)

now:

mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL                                                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.09 sec)

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

@zclllyybb
Copy link
Contributor Author

run buildall

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

be/src/vec/functions/function_convert_tz.h Show resolved Hide resolved
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17687	4480	4379	4379
q2	2229	199	188	188
q3	10454	1169	1031	1031
q4	10201	849	770	770
q5	7531	2605	2635	2605
q6	216	137	139	137
q7	954	593	597	593
q8	9223	2070	2045	2045
q9	8922	6504	6478	6478
q10	8807	3746	3716	3716
q11	441	235	236	235
q12	395	228	225	225
q13	17849	2972	2999	2972
q14	255	222	232	222
q15	519	477	485	477
q16	473	367	369	367
q17	958	634	685	634
q18	7998	7649	7385	7385
q19	1690	1568	1474	1474
q20	694	327	335	327
q21	4891	3086	3860	3086
q22	389	341	346	341
Total cold run time: 112776 ms
Total hot run time: 39687 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4310	4264	4236	4236
q2	376	269	274	269
q3	2957	2716	2729	2716
q4	1878	1578	1677	1578
q5	5234	5244	5260	5244
q6	214	128	128	128
q7	2127	1691	1720	1691
q8	3197	3333	3280	3280
q9	8405	8336	8310	8310
q10	3810	3598	3635	3598
q11	559	478	476	476
q12	753	600	614	600
q13	16546	2967	2978	2967
q14	292	254	279	254
q15	509	486	465	465
q16	455	399	423	399
q17	1837	1464	1456	1456
q18	7642	7520	7351	7351
q19	1702	1600	1530	1530
q20	1965	1793	1761	1761
q21	4820	4588	4663	4588
q22	623	554	539	539
Total cold run time: 70211 ms
Total hot run time: 53436 ms

@doris-robot
Copy link

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

query1	922	402	373	373
query2	6491	2404	2388	2388
query3	6654	204	216	204
query4	27829	17581	17226	17226
query5	4239	488	480	480
query6	261	162	184	162
query7	4605	294	290	290
query8	307	291	290	290
query9	8590	2443	2424	2424
query10	618	297	284	284
query11	11852	10019	10079	10019
query12	140	89	85	85
query13	1667	373	387	373
query14	10191	7685	7626	7626
query15	235	182	185	182
query16	7834	314	305	305
query17	1701	562	529	529
query18	1955	282	270	270
query19	200	150	147	147
query20	89	82	81	81
query21	211	130	127	127
query22	4475	4447	4111	4111
query23	33956	33120	33110	33110
query24	11984	2778	2788	2778
query25	670	360	378	360
query26	1832	151	152	151
query27	2899	313	310	310
query28	7344	2069	2064	2064
query29	1159	613	609	609
query30	284	144	145	144
query31	946	725	741	725
query32	93	54	54	54
query33	772	317	296	296
query34	916	496	485	485
query35	721	621	606	606
query36	1128	941	935	935
query37	196	74	75	74
query38	2874	2727	2718	2718
query39	832	787	802	787
query40	275	126	124	124
query41	55	52	50	50
query42	122	98	103	98
query43	588	532	555	532
query44	1181	744	730	730
query45	198	160	163	160
query46	1066	721	706	706
query47	1858	1781	1777	1777
query48	374	292	300	292
query49	1183	429	408	408
query50	749	386	388	386
query51	6990	6856	6827	6827
query52	110	96	94	94
query53	366	289	289	289
query54	1007	444	439	439
query55	80	75	76	75
query56	296	298	280	280
query57	1165	1038	1048	1038
query58	256	249	264	249
query59	3340	3234	3203	3203
query60	321	279	283	279
query61	97	92	96	92
query62	629	447	457	447
query63	316	293	293	293
query64	10528	2179	1629	1629
query65	3174	3080	3094	3080
query66	1419	334	329	329
query67	15421	15047	14881	14881
query68	4553	541	531	531
query69	463	330	319	319
query70	1176	1105	1077	1077
query71	381	286	281	281
query72	6961	5634	5232	5232
query73	751	327	323	323
query74	6146	5530	5529	5529
query75	3412	2639	2705	2639
query76	2507	983	892	892
query77	458	367	306	306
query78	9678	8947	8898	8898
query79	2717	517	514	514
query80	2258	468	467	467
query81	581	222	218	218
query82	886	110	106	106
query83	291	175	173	173
query84	280	88	94	88
query85	2141	314	300	300
query86	494	309	318	309
query87	3247	3103	3145	3103
query88	4112	2353	2379	2353
query89	489	385	393	385
query90	1836	194	191	191
query91	131	107	106	106
query92	68	50	49	49
query93	4027	505	492	492
query94	1253	212	208	208
query95	471	309	315	309
query96	600	273	262	262
query97	3203	3047	2992	2992
query98	223	196	199	196
query99	1312	857	849	849
Total cold run time: 289942 ms
Total hot run time: 172666 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.22	0.05	0.06
query4	1.67	0.07	0.09
query5	0.50	0.48	0.48
query6	1.14	0.72	0.73
query7	0.02	0.01	0.02
query8	0.05	0.04	0.05
query9	0.55	0.47	0.47
query10	0.55	0.55	0.55
query11	0.16	0.11	0.12
query12	0.15	0.12	0.13
query13	0.60	0.59	0.58
query14	0.79	0.75	0.78
query15	0.85	0.83	0.82
query16	0.37	0.36	0.37
query17	1.05	0.99	1.00
query18	0.21	0.22	0.25
query19	1.75	1.68	1.66
query20	0.02	0.01	0.01
query21	15.40	0.74	0.64
query22	4.10	7.07	2.49
query23	18.34	1.41	1.22
query24	2.10	0.24	0.22
query25	0.16	0.08	0.08
query26	0.31	0.21	0.21
query27	0.46	0.22	0.22
query28	13.27	1.02	0.99
query29	12.65	3.36	3.28
query30	0.26	0.06	0.06
query31	2.86	0.39	0.38
query32	3.27	0.48	0.46
query33	2.88	2.91	2.91
query34	17.06	4.33	4.36
query35	4.42	4.41	4.41
query36	0.65	0.50	0.48
query37	0.18	0.15	0.16
query38	0.15	0.15	0.14
query39	0.04	0.03	0.04
query40	0.16	0.13	0.13
query41	0.10	0.05	0.05
query42	0.05	0.04	0.04
query43	0.04	0.04	0.03
Total cold run time: 109.68 s
Total hot run time: 31.03 s

Copy link
Contributor

github-actions bot commented Jul 8, 2024

PR approved by anyone and no changes requested.

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

github-actions bot commented Jul 8, 2024

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

@zhangstar333 zhangstar333 merged commit f6c593c into apache:master Jul 8, 2024
27 of 30 checks passed
dataroaring pushed a commit that referenced this pull request Jul 17, 2024
)

## Proposed changes

Issue Number: close #xxx

before:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-31 08:01:19                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)
```
now:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL                                                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.09 sec)
```
zclllyybb added a commit to zclllyybb/doris that referenced this pull request Jul 24, 2024
…che#37358)

Issue Number: close #xxx

before:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-31 08:01:19                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)
```
now:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL                                                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.09 sec)
```
zclllyybb added a commit to zclllyybb/doris that referenced this pull request Jul 24, 2024
…che#37358)

## Proposed changes

Issue Number: close #xxx

before:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-31 08:01:19                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)
```
now:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL                                                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.09 sec)
```
yiguolei pushed a commit that referenced this pull request Jul 25, 2024
…nd (#37358) (#38313)

## Proposed changes

pick #37358

before:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-31 08:01:19                                                                                                                               |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)
```
now:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'  as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL                                                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.09 sec)
```
@zclllyybb zclllyybb deleted the convert_tz branch July 25, 2024 09:54
@yiguolei yiguolei mentioned this pull request Sep 5, 2024
3 tasks
mongo360 pushed a commit to mongo360/doris that referenced this pull request Dec 11, 2024
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.

8 participants