Skip to content

Conversation

@zclllyybb
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

before:

mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 15:15:30                                  |
+------------------------------------------------------+
1 row in set (0.19 sec)

now:

mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 16:15:30                                  |
+------------------------------------------------------+
1 row in set (0.12 sec)

Release note

Fix incorrect daylight saving time handling

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

@zclllyybb
Copy link
Contributor Author

run buildall

@Thearas
Copy link
Contributor

Thearas commented Jun 3, 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?

@zclllyybb zclllyybb added the p0_w label Jun 3, 2025
@zclllyybb
Copy link
Contributor Author

run performance

@zclllyybb zclllyybb closed this Jun 3, 2025
@zclllyybb zclllyybb reopened this Jun 3, 2025
@zclllyybb zclllyybb added dev/2.1.x dev/3.0.x dev/3.1.x usercase Important user case type label labels Jun 23, 2025
@zclllyybb
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (21/21) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 56.59% (15111/26702)
Line Coverage 45.39% (135444/298408)
Region Coverage 44.55% (68173/153035)
Branch Coverage 39.11% (35006/89506)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (21/21) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 61.92% (16265/26269)
Line Coverage 51.45% (153413/298207)
Region Coverage 48.86% (87947/180009)
Branch Coverage 42.30% (43260/102274)

@zclllyybb
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17577	5174	5003	5003
q2	1926	297	189	189
q3	10290	1345	733	733
q4	10228	1003	507	507
q5	7522	2420	2339	2339
q6	181	164	131	131
q7	899	748	592	592
q8	9312	1279	1078	1078
q9	6824	5138	5099	5099
q10	6888	2396	1988	1988
q11	486	295	284	284
q12	344	345	211	211
q13	17764	3671	3015	3015
q14	235	223	224	223
q15	559	478	474	474
q16	434	421	363	363
q17	591	916	361	361
q18	7855	7178	7120	7120
q19	1412	951	528	528
q20	349	338	222	222
q21	3726	3142	2318	2318
q22	1013	1030	965	965
Total cold run time: 106415 ms
Total hot run time: 33743 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5144	5096	5046	5046
q2	246	318	229	229
q3	2194	2650	2288	2288
q4	1333	1790	1309	1309
q5	4238	4093	4322	4093
q6	207	165	128	128
q7	1937	1939	1769	1769
q8	2594	2516	2487	2487
q9	7201	7155	7163	7155
q10	3088	3257	2863	2863
q11	580	521	486	486
q12	660	787	626	626
q13	3508	3921	3220	3220
q14	279	291	273	273
q15	538	483	480	480
q16	458	495	430	430
q17	1184	1789	1327	1327
q18	7669	7266	7059	7059
q19	761	758	950	758
q20	1905	2039	1855	1855
q21	4779	4382	4220	4220
q22	1066	1077	1008	1008
Total cold run time: 51569 ms
Total hot run time: 49109 ms

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17593	5408	5184	5184
q2	1942	273	191	191
q3	10384	1313	700	700
q4	10284	1033	516	516
q5	8084	2417	2325	2325
q6	195	166	134	134
q7	904	752	597	597
q8	9324	1437	1284	1284
q9	6780	5236	5218	5218
q10	6956	2410	1955	1955
q11	489	290	273	273
q12	342	367	215	215
q13	17798	3672	3136	3136
q14	224	222	209	209
q15	582	478	466	466
q16	432	415	369	369
q17	600	916	362	362
q18	7456	7314	7147	7147
q19	1819	1029	567	567
q20	341	330	220	220
q21	3927	3220	2383	2383
q22	1037	1004	971	971
Total cold run time: 107493 ms
Total hot run time: 34422 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5434	5416	5278	5278
q2	252	338	222	222
q3	2142	2604	2286	2286
q4	1337	1804	1332	1332
q5	4232	4239	4374	4239
q6	209	171	127	127
q7	2077	1863	1744	1744
q8	2853	2596	2534	2534
q9	7184	7108	7190	7108
q10	3102	3257	2821	2821
q11	590	510	496	496
q12	680	779	638	638
q13	3564	3885	3296	3296
q14	305	314	272	272
q15	517	467	461	461
q16	446	482	434	434
q17	1157	1584	1320	1320
q18	7400	7246	7055	7055
q19	842	808	855	808
q20	1976	1945	1811	1811
q21	4711	4382	4301	4301
q22	1075	1060	972	972
Total cold run time: 52085 ms
Total hot run time: 49555 ms

@doris-robot
Copy link

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

query1	996	379	412	379
query2	6538	1855	1831	1831
query3	6747	225	221	221
query4	26164	23190	23256	23190
query5	4348	634	488	488
query6	313	224	205	205
query7	4626	501	291	291
query8	264	223	206	206
query9	8596	2686	2694	2686
query10	482	349	274	274
query11	15380	15116	14815	14815
query12	163	109	107	107
query13	1656	538	411	411
query14	9259	6166	6111	6111
query15	197	189	179	179
query16	7662	621	448	448
query17	1200	738	608	608
query18	2057	427	319	319
query19	208	211	170	170
query20	123	119	117	117
query21	212	132	113	113
query22	4371	4386	4225	4225
query23	33929	33205	33125	33125
query24	8439	2342	2386	2342
query25	542	473	403	403
query26	1205	273	146	146
query27	2708	515	351	351
query28	4286	2116	2124	2116
query29	750	549	428	428
query30	286	219	197	197
query31	924	843	792	792
query32	70	62	64	62
query33	570	372	313	313
query34	795	847	540	540
query35	779	835	731	731
query36	941	969	887	887
query37	109	102	75	75
query38	4128	4097	4009	4009
query39	1490	1422	1390	1390
query40	207	119	104	104
query41	62	60	61	60
query42	128	105	104	104
query43	496	507	491	491
query44	1319	832	822	822
query45	184	170	164	164
query46	840	1026	633	633
query47	1727	1779	1752	1752
query48	401	434	305	305
query49	739	495	391	391
query50	622	669	405	405
query51	4147	4155	4259	4155
query52	108	107	96	96
query53	224	262	188	188
query54	578	580	497	497
query55	86	81	86	81
query56	301	307	280	280
query57	1221	1207	1109	1109
query58	267	257	262	257
query59	2656	2690	2664	2664
query60	316	322	329	322
query61	137	124	125	124
query62	805	751	671	671
query63	218	191	189	189
query64	4315	1003	668	668
query65	4266	4198	4187	4187
query66	1080	417	328	328
query67	15970	15505	15329	15329
query68	8691	891	540	540
query69	454	314	272	272
query70	1193	1089	1102	1089
query71	456	309	304	304
query72	5331	4774	4886	4774
query73	736	654	358	358
query74	9171	9051	8945	8945
query75	4003	3194	2690	2690
query76	3637	1168	746	746
query77	782	376	281	281
query78	10228	10201	9427	9427
query79	1903	815	595	595
query80	572	513	450	450
query81	470	260	219	219
query82	425	126	99	99
query83	248	259	236	236
query84	247	109	87	87
query85	775	365	305	305
query86	337	296	298	296
query87	4400	4407	4270	4270
query88	3169	2295	2285	2285
query89	375	319	295	295
query90	1933	213	207	207
query91	140	141	113	113
query92	79	60	59	59
query93	1323	955	589	589
query94	670	412	287	287
query95	380	294	278	278
query96	486	571	282	282
query97	2752	2744	2696	2696
query98	237	213	205	205
query99	1681	1404	1280	1280
Total cold run time: 274217 ms
Total hot run time: 186236 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.07	0.04	0.03
query3	0.24	0.08	0.06
query4	1.61	0.10	0.10
query5	0.44	0.42	0.44
query6	1.17	0.66	0.67
query7	0.03	0.02	0.02
query8	0.05	0.03	0.04
query9	0.58	0.50	0.52
query10	0.57	0.59	0.57
query11	0.15	0.11	0.11
query12	0.14	0.11	0.12
query13	0.64	0.61	0.61
query14	0.80	0.82	0.79
query15	0.89	0.85	0.89
query16	0.41	0.37	0.38
query17	1.05	1.02	1.05
query18	0.23	0.21	0.22
query19	1.91	1.86	1.89
query20	0.01	0.01	0.01
query21	15.42	0.85	0.52
query22	0.79	1.34	0.88
query23	14.77	1.32	0.67
query24	6.99	1.25	1.57
query25	0.54	0.15	0.14
query26	0.51	0.16	0.14
query27	0.06	0.06	0.04
query28	9.49	0.89	0.43
query29	12.56	3.97	3.26
query30	0.26	0.10	0.06
query31	2.82	0.60	0.40
query32	3.23	0.55	0.47
query33	3.03	3.05	3.13
query34	16.11	5.36	4.71
query35	4.81	4.87	4.77
query36	0.66	0.52	0.49
query37	0.08	0.07	0.07
query38	0.05	0.04	0.04
query39	0.03	0.02	0.03
query40	0.18	0.14	0.14
query41	0.08	0.02	0.02
query42	0.03	0.03	0.02
query43	0.03	0.03	0.03
Total cold run time: 103.56 s
Total hot run time: 29.98 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 67.74% (21/31) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 56.60% (15113/26703)
Line Coverage 45.40% (135482/298447)
Region Coverage 44.55% (68191/153058)
Branch Coverage 39.12% (35019/89518)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 67.74% (21/31) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 62.09% (16312/26271)
Line Coverage 51.66% (154094/298265)
Region Coverage 49.08% (88361/180040)
Branch Coverage 42.54% (43516/102294)

1 similar comment
@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 67.74% (21/31) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 62.09% (16312/26271)
Line Coverage 51.66% (154094/298265)
Region Coverage 49.08% (88361/180040)
Branch Coverage 42.54% (43516/102294)

@BiteTheDDDDt BiteTheDDDDt requested a review from Copilot June 24, 2025 07:12

This comment was marked as outdated.

@BiteTheDDDDt BiteTheDDDDt requested a review from Copilot June 24, 2025 07:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the incorrect handling of daylight saving time in datetime conversions by updating conversion logic, expected outputs, and regression tests. Key changes include adding new test cases for DST and non-DST scenarios, updating expected outputs in several test files, and refactoring the datetime conversion implementation for more reliable DST handling.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
regression-test/suites/datatype_p0/datetimev2/test_timezone.groovy Added regression tests for DST and non-DST timezone conversions.
regression-test/data/datatype_p0/datetimev2/test_tz_streamload.out Updated expected output timestamp for streamload tests.
regression-test/data/datatype_p0/datetimev2/test_timezone.out Modified expected output for timezone tests to reflect DST adjustments.
regression-test/data/cast_p0/cast_to_datetime.out Adjusted expected output timestamps in datetime cast tests.
be/test/vec/function/function_test_util.h Enhanced error output for function result mismatches.
be/test/vec/function/cast/cast_to_datetime_test.cpp Updated test expectations to match new timezone handling.
be/test/vec/function/cast/cast_to_date_test.cpp Revised expected outputs in date cast tests to align with new timezone logic.
be/src/vec/runtime/vdatetime_value.h Fixed uninitialized variable issues in datetime comparison operators.
be/src/vec/runtime/vdatetime_value.cpp Refactored DST conversion logic and updated type handling for timezone offsets.
be/src/olap/rowset/segment_v2/inverted_index/util/priority_queue.h Cleaned up redundant max_size validation for the priority queue.

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

@zhangstar333 zhangstar333 merged commit f430a4c into apache:master Jun 24, 2025
28 of 31 checks passed
@zclllyybb zclllyybb deleted the dst_be branch June 24, 2025 08:20
zclllyybb added a commit to zclllyybb/doris that referenced this pull request Jun 27, 2025
Problem Summary:

before:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 15:15:30                                  |
+------------------------------------------------------+
1 row in set (0.19 sec)
```

now:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 16:15:30                                  |
+------------------------------------------------------+
1 row in set (0.12 sec)
```
zclllyybb added a commit to zclllyybb/doris that referenced this pull request Jun 27, 2025
Problem Summary:

before:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 15:15:30                                  |
+------------------------------------------------------+
1 row in set (0.19 sec)
```

now:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 16:15:30                                  |
+------------------------------------------------------+
1 row in set (0.12 sec)
```
zclllyybb added a commit to zclllyybb/doris that referenced this pull request Jun 27, 2025
Problem Summary:

before:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 15:15:30                                  |
+------------------------------------------------------+
1 row in set (0.19 sec)
```

now:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 16:15:30                                  |
+------------------------------------------------------+
1 row in set (0.12 sec)
```
zclllyybb added a commit to zclllyybb/doris that referenced this pull request Jun 27, 2025
Problem Summary:

before:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 15:15:30                                  |
+------------------------------------------------------+
1 row in set (0.19 sec)
```

now:
```sql
mysql> select/*+SET_VAR(debug_skip_fold_constant=true)*/ cast('2010-01-05 08:15:30Europe/London' as datetime);
+------------------------------------------------------+
| cast('2010-01-05 08:15:30Europe/London' as datetime) |
+------------------------------------------------------+
| 2010-01-05 16:15:30                                  |
+------------------------------------------------------+
1 row in set (0.12 sec)
```
morrySnow pushed a commit that referenced this pull request Jun 28, 2025
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.11-merged dev/3.0.7-merged dev/3.1.0-merged p0_w reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants