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

branch-3.0: [fix](date_function) fix str_to_date function return wrong microsecond issue #47129 #47261

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

github-actions[bot]
Copy link
Contributor

Cherry-picked from #47129

…d issue (#47129)

### What problem does this PR solve?

Issue Number: close #47105

Related PR: #24932

Problem Summary:

### Release note

str_to_date always return microsecond part for datetime even if user
does not specfic %f in date format string. This is wrong.
mysql> select id,str_to_date(dt, '%Y-%m-%d %H:%i:%s') from test1 limit
1;
+------+--------------------------------------+
| id   | str_to_date(dt, '%Y-%m-%d %H:%i:%s') |
+------+--------------------------------------+
|    2 | 2024-12-28 10:11:12.000000           |
+------+--------------------------------------+

and constant fold scenario is wrong too:
mysql> select cast(str_to_date('2025-01-17 11:59:30', '%Y-%m-%d
%H:%i:%s') as string);

+--------------------------------------------------------------------------+
| cast(str_to_date('2025-01-17 11:59:30', '%Y-%m-%d %H:%i:%s') as TEXT)
|

+--------------------------------------------------------------------------+
| 2025-01-17 11:59:30.000000 |

+--------------------------------------------------------------------------+


### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [x] Regression test
    - [ ] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [x] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
@github-actions github-actions bot requested a review from dataroaring as a code owner January 21, 2025 04:47
@hello-stephen
Copy link
Contributor

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?

@dataroaring dataroaring reopened this Jan 21, 2025
@hello-stephen
Copy link
Contributor

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17607	8118	7246	7246
q2	2072	173	167	167
q3	10628	1071	1155	1071
q4	10550	699	690	690
q5	7736	2793	2809	2793
q6	232	151	151	151
q7	1001	612	597	597
q8	9577	1964	2027	1964
q9	6972	6365	6397	6365
q10	7006	2312	2314	2312
q11	463	272	267	267
q12	407	211	210	210
q13	17784	3007	3004	3004
q14	237	212	205	205
q15	571	513	531	513
q16	681	612	613	612
q17	949	614	560	560
q18	7221	6637	6670	6637
q19	1397	1100	1058	1058
q20	482	215	212	212
q21	4467	3400	3254	3254
q22	1143	1027	1002	1002
Total cold run time: 109183 ms
Total hot run time: 40890 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7240	7144	7218	7144
q2	336	229	235	229
q3	2968	2908	2960	2908
q4	2056	1807	1794	1794
q5	5721	5738	5716	5716
q6	227	146	148	146
q7	2238	1888	1807	1807
q8	3317	3588	3484	3484
q9	8815	8918	8785	8785
q10	3553	3549	3512	3512
q11	614	514	505	505
q12	818	635	616	616
q13	8241	3151	3181	3151
q14	298	267	284	267
q15	579	522	529	522
q16	717	670	663	663
q17	1850	1627	1626	1626
q18	8153	7670	7766	7670
q19	1672	1433	1625	1433
q20	2110	1895	1884	1884
q21	5533	5375	5250	5250
q22	1164	1032	1038	1032
Total cold run time: 68220 ms
Total hot run time: 60144 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 197682 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 4b96f2e2c1073d5d908ee7c48dc9bc03ba427acb, data reload: false

query1	1331	918	908	908
query2	6243	2017	2006	2006
query3	10858	4352	4159	4159
query4	65525	28848	23859	23859
query5	5149	457	442	442
query6	430	180	171	171
query7	5597	312	318	312
query8	309	239	225	225
query9	9043	2674	2662	2662
query10	449	293	268	268
query11	17315	15166	15957	15166
query12	164	104	110	104
query13	1516	446	437	437
query14	10519	7467	7645	7467
query15	202	189	176	176
query16	7184	490	503	490
query17	1087	616	603	603
query18	1807	338	332	332
query19	215	173	158	158
query20	117	116	105	105
query21	211	102	107	102
query22	4729	4490	4308	4308
query23	34820	34293	34069	34069
query24	6081	2908	3021	2908
query25	557	422	430	422
query26	661	182	175	175
query27	1850	360	355	355
query28	4598	2517	2475	2475
query29	731	463	464	463
query30	255	165	163	163
query31	994	823	842	823
query32	74	60	58	58
query33	439	289	292	289
query34	928	526	533	526
query35	841	739	729	729
query36	1090	980	985	980
query37	126	71	74	71
query38	4229	4041	4089	4041
query39	1539	1470	1490	1470
query40	204	99	98	98
query41	50	48	47	47
query42	117	101	103	101
query43	540	492	491	491
query44	1214	843	845	843
query45	185	169	166	166
query46	1144	733	769	733
query47	2042	1919	1939	1919
query48	472	367	378	367
query49	719	379	393	379
query50	871	432	437	432
query51	7272	7303	7034	7034
query52	100	88	88	88
query53	266	184	186	184
query54	566	462	455	455
query55	78	80	79	79
query56	255	245	249	245
query57	1226	1092	1084	1084
query58	217	209	206	206
query59	3207	2911	3035	2911
query60	283	258	252	252
query61	105	112	124	112
query62	775	648	665	648
query63	224	184	187	184
query64	1368	656	638	638
query65	3269	3222	3213	3213
query66	695	304	303	303
query67	15947	15736	15378	15378
query68	4168	589	598	589
query69	436	270	285	270
query70	1200	1142	1118	1118
query71	355	261	262	261
query72	6338	4150	4092	4092
query73	774	354	352	352
query74	10259	8956	9003	8956
query75	3376	2660	2660	2660
query76	1864	1055	1092	1055
query77	527	272	277	272
query78	10717	9690	9545	9545
query79	1290	598	596	596
query80	799	425	426	425
query81	522	248	237	237
query82	1361	122	118	118
query83	244	149	141	141
query84	287	82	84	82
query85	885	303	291	291
query86	339	305	306	305
query87	4411	4251	4443	4251
query88	3569	2405	2343	2343
query89	412	290	293	290
query90	1989	188	190	188
query91	182	149	147	147
query92	61	50	52	50
query93	1328	533	552	533
query94	769	310	280	280
query95	349	260	261	260
query96	612	282	292	282
query97	3337	3166	3156	3156
query98	225	203	200	200
query99	1736	1302	1270	1270
Total cold run time: 317945 ms
Total hot run time: 197682 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.06	0.04	0.03
query3	0.23	0.06	0.06
query4	1.63	0.11	0.10
query5	0.50	0.49	0.49
query6	1.14	0.74	0.74
query7	0.02	0.01	0.02
query8	0.04	0.03	0.02
query9	0.55	0.49	0.51
query10	0.55	0.55	0.55
query11	0.15	0.09	0.11
query12	0.17	0.12	0.10
query13	0.61	0.59	0.61
query14	3.05	3.06	2.91
query15	0.91	0.83	0.83
query16	0.39	0.39	0.39
query17	1.05	1.04	1.06
query18	0.24	0.22	0.22
query19	2.00	1.89	1.83
query20	0.01	0.01	0.02
query21	15.36	0.63	0.60
query22	2.79	1.78	1.58
query23	16.81	0.93	1.08
query24	3.05	1.80	1.20
query25	0.25	0.08	0.19
query26	0.42	0.14	0.13
query27	0.04	0.05	0.04
query28	9.79	1.11	1.09
query29	12.60	3.28	3.32
query30	0.24	0.06	0.06
query31	2.87	0.39	0.37
query32	3.26	0.47	0.45
query33	3.01	3.03	3.07
query34	16.93	4.43	4.49
query35	4.51	4.57	4.55
query36	0.67	0.47	0.50
query37	0.10	0.06	0.06
query38	0.05	0.03	0.03
query39	0.04	0.02	0.03
query40	0.16	0.13	0.12
query41	0.08	0.02	0.03
query42	0.03	0.02	0.02
query43	0.03	0.02	0.02
Total cold run time: 106.43 s
Total hot run time: 33.11 s

@Yulei-Yang Yulei-Yang merged commit 1ea4450 into branch-3.0 Jan 22, 2025
22 checks passed
@Yulei-Yang Yulei-Yang deleted the auto-pick-47129-branch-3.0 branch January 22, 2025 01:13
dataroaring added a commit that referenced this pull request Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants