Skip to content

Conversation

@linrrzqqq
Copy link
Contributor

@linrrzqqq linrrzqqq commented Oct 27, 2025

What problem does this PR solve?

Issue Number: #48203

Related PR: #xxx

Problem Summary:

Release note

  1. Support UTC_TIMESTAMP with precision
mysql> SELECT UTC_TIMESTAMP(5), UTC_TIMESTAMP(5) + 1;
+---------------------------+----------------------+
| UTC_TIMESTAMP(5)          | UTC_TIMESTAMP(5) + 1 |
+---------------------------+----------------------+
| 2025-10-27 06:38:34.45620 |       20251027063835 |
+---------------------------+----------------------+

mysql> SELECT UTC_TIMESTAMP(7);
ERROR 1105 (HY000): errCode = 2, detailMessage = scale must be between 0 and 6
  1. Support UTC_DATE and UTC_TIME
mysql> SELECT UTC_TIME(), UTC_TIME() + 1, UTC_TIME(6), UTC_TIME(6) + 1;
------------+----------------+-----------------+-----------------+
| UTC_TIME() | UTC_TIME() + 1 | UTC_TIME(6)     | UTC_TIME(6) + 1 |
+------------+----------------+-----------------+-----------------+
| 06:39:01   |    23941000001 | 06:39:01.934119 |     23941934120 |
+------------+----------------+-----------------+-----------------+

mysql> SELECT UTC_TIME(7);
ERROR 1105 (HY000): errCode = 2, detailMessage = scale must be between 0 and 6

mysql> SELECT UTC_DATE();
+------------+
| UTC_DATE() |
+------------+
| 2025-10-27 |
+------------+

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?

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

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

@zclllyybb zclllyybb self-assigned this Oct 27, 2025
@linrrzqqq linrrzqqq marked this pull request as draft October 27, 2025 03:03
@linrrzqqq linrrzqqq marked this pull request as ready for review October 27, 2025 03:07
@linrrzqqq linrrzqqq marked this pull request as draft October 27, 2025 03:19
@linrrzqqq linrrzqqq changed the title [Feature](func) Support function UTC_DATE & UTC_TIME [Feature](func) Support function UTC_DATE & UTC_TIME, and UTC_TIMESTAMP with precision Oct 27, 2025
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.

codes good, try add BEUT to check result

@zclllyybb zclllyybb marked this pull request as ready for review October 27, 2025 06:50
@linrrzqqq
Copy link
Contributor Author

run buildall

zclllyybb
zclllyybb previously approved these changes Oct 27, 2025
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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 27, 2025
@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.

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/56) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.10	0.05	0.05
query3	0.26	0.08	0.08
query4	1.61	0.12	0.12
query5	0.28	0.26	0.25
query6	1.20	0.66	0.67
query7	0.04	0.03	0.02
query8	0.07	0.05	0.04
query9	0.62	0.54	0.52
query10	0.59	0.60	0.57
query11	0.17	0.11	0.12
query12	0.16	0.12	0.12
query13	0.63	0.60	0.62
query14	1.02	1.02	1.02
query15	0.87	0.84	0.87
query16	0.42	0.39	0.42
query17	1.03	1.06	1.06
query18	0.23	0.21	0.21
query19	1.94	1.88	1.84
query20	0.02	0.02	0.02
query21	15.43	0.18	0.13
query22	5.06	0.07	0.05
query23	15.64	0.28	0.12
query24	2.61	1.13	0.80
query25	0.08	0.07	0.06
query26	0.15	0.15	0.14
query27	0.08	0.06	0.05
query28	5.08	1.16	0.94
query29	12.58	4.11	3.34
query30	0.29	0.15	0.12
query31	2.84	0.59	0.39
query32	3.24	0.57	0.47
query33	3.04	3.14	3.08
query34	15.99	5.20	4.52
query35	4.59	4.58	4.58
query36	0.68	0.51	0.50
query37	0.11	0.08	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.04
query40	0.18	0.15	0.13
query41	0.09	0.04	0.04
query42	0.05	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 99.27 s
Total hot run time: 28.24 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 23.21% (13/56) 🎉
Increment coverage report
Complete coverage report

@zclllyybb
Copy link
Contributor

run beut

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 70.59% (24/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.77% (18059/34223)
Line Coverage 38.00% (163740/430891)
Region Coverage 32.37% (124758/385463)
Branch Coverage 33.74% (54556/161715)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 70.59% (24/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.38% (23928/33523)
Line Coverage 57.82% (248963/430593)
Region Coverage 53.03% (206874/390084)
Branch Coverage 54.65% (88772/162426)

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Oct 28, 2025
@linrrzqqq
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.05
query3	0.26	0.09	0.08
query4	1.61	0.12	0.12
query5	0.28	0.26	0.26
query6	1.18	0.66	0.64
query7	0.03	0.02	0.02
query8	0.05	0.05	0.04
query9	0.64	0.54	0.52
query10	0.58	0.57	0.58
query11	0.17	0.11	0.12
query12	0.16	0.13	0.12
query13	0.62	0.60	0.64
query14	1.02	1.02	1.00
query15	0.87	0.84	0.86
query16	0.39	0.42	0.39
query17	1.06	1.04	1.03
query18	0.22	0.20	0.21
query19	1.98	1.86	1.87
query20	0.02	0.02	0.02
query21	15.42	0.19	0.12
query22	5.04	0.07	0.04
query23	15.66	0.27	0.10
query24	2.54	0.88	0.86
query25	0.08	0.07	0.07
query26	0.15	0.15	0.13
query27	0.08	0.05	0.06
query28	4.99	1.15	0.94
query29	12.63	3.99	3.25
query30	0.28	0.14	0.11
query31	2.82	0.60	0.38
query32	3.24	0.55	0.47
query33	3.03	3.05	3.05
query34	15.85	5.16	4.55
query35	4.60	4.58	4.56
query36	0.70	0.52	0.50
query37	0.10	0.06	0.06
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.14	0.15
query41	0.09	0.04	0.03
query42	0.05	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 98.95 s
Total hot run time: 28.06 s

@linrrzqqq
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 23.21% (13/56) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 97.06% (33/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.76% (18059/34226)
Line Coverage 38.00% (163749/430972)
Region Coverage 32.35% (124731/385550)
Branch Coverage 33.73% (54553/161731)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 70.59% (24/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.40% (23940/33531)
Line Coverage 57.79% (248948/430777)
Region Coverage 52.79% (206002/390262)
Branch Coverage 54.52% (88596/162504)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 23.21% (13/56) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 70.59% (24/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.40% (23940/33531)
Line Coverage 57.79% (248948/430777)
Region Coverage 52.79% (206002/390262)
Branch Coverage 54.52% (88596/162504)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 23.21% (13/56) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 70.59% (24/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.40% (23940/33531)
Line Coverage 57.79% (248940/430777)
Region Coverage 52.79% (206029/390262)
Branch Coverage 54.51% (88589/162504)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 23.21% (13/56) 🎉
Increment coverage report
Complete coverage report

@zclllyybb
Copy link
Contributor

run performance

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 29, 2025
@github-actions
Copy link
Contributor

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

@doris-robot
Copy link

TPC-DS: Total hot run time: 190948 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 0b20dda5b92e54529338f6ef1cfe1e397c62c914, data reload: false

query1	1098	429	403	403
query2	6564	1723	1686	1686
query3	6754	226	229	226
query4	26209	23929	23539	23539
query5	5257	646	499	499
query6	355	244	236	236
query7	4669	508	308	308
query8	311	273	307	273
query9	8728	2591	2636	2591
query10	564	348	292	292
query11	15386	15169	14874	14874
query12	190	127	120	120
query13	1692	584	448	448
query14	11981	9312	9311	9311
query15	248	194	211	194
query16	7811	668	526	526
query17	1594	784	602	602
query18	2073	465	354	354
query19	326	238	198	198
query20	143	133	131	131
query21	228	149	135	135
query22	4573	4734	4489	4489
query23	34897	33902	33904	33902
query24	8451	2535	2533	2533
query25	593	583	470	470
query26	1366	289	182	182
query27	2879	522	373	373
query28	4485	2320	2243	2243
query29	822	650	508	508
query30	327	251	214	214
query31	979	818	792	792
query32	85	78	70	70
query33	596	403	359	359
query34	870	907	539	539
query35	864	891	828	828
query36	986	1075	938	938
query37	138	113	83	83
query38	3532	3606	3501	3501
query39	1499	1419	1428	1419
query40	217	125	120	120
query41	62	59	61	59
query42	126	112	109	109
query43	491	498	482	482
query44	1209	741	741	741
query45	188	181	170	170
query46	891	1005	642	642
query47	1768	1813	1751	1751
query48	393	416	330	330
query49	788	508	437	437
query50	645	695	405	405
query51	3884	3919	3845	3845
query52	113	108	101	101
query53	244	270	196	196
query54	605	602	539	539
query55	93	90	89	89
query56	318	317	291	291
query57	1193	1245	1117	1117
query58	295	268	278	268
query59	2573	2619	2546	2546
query60	345	340	331	331
query61	159	158	158	158
query62	796	726	667	667
query63	240	203	191	191
query64	4411	1146	850	850
query65	4032	3983	3963	3963
query66	1059	427	330	330
query67	15537	15361	15081	15081
query68	8197	909	609	609
query69	501	333	294	294
query70	1388	1299	1247	1247
query71	506	345	328	328
query72	6020	5004	4828	4828
query73	706	573	364	364
query74	8912	9276	8972	8972
query75	4109	3347	2905	2905
query76	3806	1172	761	761
query77	819	416	301	301
query78	9740	9755	8925	8925
query79	2365	839	605	605
query80	704	562	494	494
query81	527	271	231	231
query82	489	164	127	127
query83	300	272	261	261
query84	305	127	94	94
query85	886	502	443	443
query86	333	298	306	298
query87	3790	3788	3699	3699
query88	3551	2215	2238	2215
query89	393	339	307	307
query90	2052	226	215	215
query91	162	164	136	136
query92	85	66	69	66
query93	1657	996	645	645
query94	694	457	336	336
query95	408	326	310	310
query96	492	586	286	286
query97	2977	2997	2938	2938
query98	260	218	208	208
query99	1458	1399	1302	1302
Total cold run time: 281390 ms
Total hot run time: 190948 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.04
query2	0.09	0.05	0.05
query3	0.26	0.09	0.08
query4	1.60	0.12	0.12
query5	0.28	0.28	0.26
query6	1.17	0.65	0.64
query7	0.04	0.03	0.03
query8	0.05	0.05	0.05
query9	0.62	0.53	0.53
query10	0.58	0.58	0.57
query11	0.16	0.11	0.12
query12	0.16	0.12	0.12
query13	0.62	0.61	0.61
query14	1.01	1.02	1.00
query15	0.87	0.84	0.86
query16	0.39	0.40	0.43
query17	1.07	1.06	1.11
query18	0.22	0.20	0.20
query19	1.92	1.80	1.80
query20	0.01	0.01	0.01
query21	15.44	0.17	0.13
query22	5.13	0.07	0.05
query23	15.69	0.27	0.12
query24	2.62	0.97	0.30
query25	0.07	0.06	0.06
query26	0.15	0.13	0.13
query27	0.06	0.06	0.05
query28	3.86	1.14	0.94
query29	12.54	3.94	3.37
query30	0.28	0.13	0.14
query31	2.82	0.59	0.38
query32	3.24	0.55	0.46
query33	3.05	3.13	3.08
query34	15.78	5.13	4.55
query35	4.61	4.61	4.58
query36	0.68	0.51	0.50
query37	0.10	0.06	0.07
query38	0.07	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.15	0.15
query41	0.09	0.04	0.03
query42	0.04	0.04	0.03
query43	0.05	0.04	0.03
Total cold run time: 97.75 s
Total hot run time: 27.72 s

@zclllyybb zclllyybb merged commit eb1d33e into apache:master Oct 29, 2025
26 of 27 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 29, 2025
…MP with precision (#57347)

### Release note
1. Support `UTC_TIMESTAMP` with precision
```text
mysql> SELECT UTC_TIMESTAMP(5), UTC_TIMESTAMP(5) + 1;
+---------------------------+----------------------+
| UTC_TIMESTAMP(5)          | UTC_TIMESTAMP(5) + 1 |
+---------------------------+----------------------+
| 2025-10-27 06:38:34.45620 |       20251027063835 |
+---------------------------+----------------------+

mysql> SELECT UTC_TIMESTAMP(7);
ERROR 1105 (HY000): errCode = 2, detailMessage = scale must be between 0 and 6
```

2. Support `UTC_DATE` and `UTC_TIME`
```text
mysql> SELECT UTC_TIME(), UTC_TIME() + 1, UTC_TIME(6), UTC_TIME(6) + 1;
------------+----------------+-----------------+-----------------+
| UTC_TIME() | UTC_TIME() + 1 | UTC_TIME(6)     | UTC_TIME(6) + 1 |
+------------+----------------+-----------------+-----------------+
| 06:39:01   |    23941000001 | 06:39:01.934119 |     23941934120 |
+------------+----------------+-----------------+-----------------+

mysql> SELECT UTC_TIME(7);
ERROR 1105 (HY000): errCode = 2, detailMessage = scale must be between 0 and 6

mysql> SELECT UTC_DATE();
+------------+
| UTC_DATE() |
+------------+
| 2025-10-27 |
+------------+
```
@linrrzqqq linrrzqqq deleted the utc_union branch October 29, 2025 05:02
yiguolei pushed a commit that referenced this pull request Oct 31, 2025
… UTC_TIMESTAMP with precision #57347 (#57443)

Cherry-picked from #57347

Co-authored-by: linrrarity <linzhenqi@selectdb.com>
dwdwqfwe pushed a commit to dwdwqfwe/doris that referenced this pull request Oct 31, 2025
…MP with precision (apache#57347)

### Release note
1. Support `UTC_TIMESTAMP` with precision
```text
mysql> SELECT UTC_TIMESTAMP(5), UTC_TIMESTAMP(5) + 1;
+---------------------------+----------------------+
| UTC_TIMESTAMP(5)          | UTC_TIMESTAMP(5) + 1 |
+---------------------------+----------------------+
| 2025-10-27 06:38:34.45620 |       20251027063835 |
+---------------------------+----------------------+

mysql> SELECT UTC_TIMESTAMP(7);
ERROR 1105 (HY000): errCode = 2, detailMessage = scale must be between 0 and 6
```

2. Support `UTC_DATE` and `UTC_TIME`
```text
mysql> SELECT UTC_TIME(), UTC_TIME() + 1, UTC_TIME(6), UTC_TIME(6) + 1;
------------+----------------+-----------------+-----------------+
| UTC_TIME() | UTC_TIME() + 1 | UTC_TIME(6)     | UTC_TIME(6) + 1 |
+------------+----------------+-----------------+-----------------+
| 06:39:01   |    23941000001 | 06:39:01.934119 |     23941934120 |
+------------+----------------+-----------------+-----------------+

mysql> SELECT UTC_TIME(7);
ERROR 1105 (HY000): errCode = 2, detailMessage = scale must be between 0 and 6

mysql> SELECT UTC_DATE();
+------------+
| UTC_DATE() |
+------------+
| 2025-10-27 |
+------------+
```
zclllyybb pushed a commit that referenced this pull request Nov 5, 2025
Related PR: #57347

Before:
```text
mysql> select utc_time(NULL);
+----------------+
| utc_time(NULL) |
+----------------+
| 00:00:00       |
+----------------+
```

After(throw error same with MySQL):
```text
mysql> select utc_time(NULL);
ERROR 1105 (HY000): errCode = 2, detailMessage = UTC_TIME argument cannot be NULL.
```
github-actions bot pushed a commit that referenced this pull request Nov 5, 2025
Related PR: #57347

Before:
```text
mysql> select utc_time(NULL);
+----------------+
| utc_time(NULL) |
+----------------+
| 00:00:00       |
+----------------+
```

After(throw error same with MySQL):
```text
mysql> select utc_time(NULL);
ERROR 1105 (HY000): errCode = 2, detailMessage = UTC_TIME argument cannot be NULL.
```
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Nov 18, 2025
Related PR: apache#57347

Before:
```text
mysql> select utc_time(NULL);
+----------------+
| utc_time(NULL) |
+----------------+
| 00:00:00       |
+----------------+
```

After(throw error same with MySQL):
```text
mysql> select utc_time(NULL);
ERROR 1105 (HY000): errCode = 2, detailMessage = UTC_TIME argument cannot be NULL.
```
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/4.0.1-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants