Skip to content

[Feature](func) Support function PREVIOUS_DAY#60680

Merged
yiguolei merged 1 commit intoapache:masterfrom
linrrzqqq:previoud_day
Feb 12, 2026
Merged

[Feature](func) Support function PREVIOUS_DAY#60680
yiguolei merged 1 commit intoapache:masterfrom
linrrzqqq:previoud_day

Conversation

@linrrzqqq
Copy link
Contributor

@linrrzqqq linrrzqqq commented Feb 11, 2026

What problem does this PR solve?

Issue Number: close #xxx

Related PR:

Release note

doc: apache/doris-website#3390

Given an input date value, return the date of the day of the week before it.

Doris> select previous_day('2023-04-06', 'Monday');
+--------------------------------------+
| previous_day('2023-04-06', 'Monday') |
+--------------------------------------+
| 2023-04-03                           |
+--------------------------------------+
1 row in set (0.13 sec)

Doris> select previous_day('2023-04-06', 'Tue');
+-----------------------------------+
| previous_day('2023-04-06', 'Tue') |
+-----------------------------------+
| 2023-04-04                        |
+-----------------------------------+
1 row in set (0.04 sec)

Doris> select previous_day('2023-04-06 20:13:14', 'Fr');
+-------------------------------------------+
| previous_day('2023-04-06 20:13:14', 'Fr') |
+-------------------------------------------+
| 2023-03-31                                |
+-------------------------------------------+
1 row in set (0.04 sec)

None

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

@linrrzqqq linrrzqqq requested a review from zclllyybb as a code owner February 11, 2026 09:01
@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?

@linrrzqqq
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17639	4559	4333	4333
q2	2078	335	234	234
q3	10157	1309	719	719
q4	10206	773	322	322
q5	7523	2186	1952	1952
q6	191	178	146	146
q7	864	741	622	622
q8	9261	1408	1117	1117
q9	4743	4645	4630	4630
q10	6832	1949	1543	1543
q11	462	266	248	248
q12	336	381	237	237
q13	17788	4053	3219	3219
q14	230	232	223	223
q15	915	851	801	801
q16	695	686	627	627
q17	700	843	530	530
q18	6360	5731	5823	5731
q19	1240	979	646	646
q20	502	497	394	394
q21	2632	1873	1801	1801
q22	329	284	245	245
Total cold run time: 101683 ms
Total hot run time: 30320 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4419	4440	4406	4406
q2	273	328	242	242
q3	2128	2734	2324	2324
q4	1448	1792	1329	1329
q5	4442	4321	4553	4321
q6	206	177	144	144
q7	1941	1898	1711	1711
q8	2707	2651	2461	2461
q9	7635	7490	7626	7490
q10	2934	3013	2637	2637
q11	502	463	450	450
q12	704	820	648	648
q13	3960	4501	3726	3726
q14	288	301	282	282
q15	848	796	814	796
q16	688	721	693	693
q17	1186	1406	1446	1406
q18	8154	8125	7887	7887
q19	954	913	1125	913
q20	2035	2119	2028	2028
q21	4843	4360	4134	4134
q22	515	498	444	444
Total cold run time: 52810 ms
Total hot run time: 50472 ms

@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 bfc903d959e78b7288e66288beee251dd21731ee, data reload: false

query1	0.05	0.05	0.04
query2	0.09	0.04	0.04
query3	0.25	0.09	0.08
query4	1.60	0.11	0.11
query5	0.27	0.25	0.26
query6	1.18	0.68	0.68
query7	0.04	0.03	0.03
query8	0.05	0.05	0.04
query9	0.58	0.50	0.48
query10	0.55	0.56	0.54
query11	0.16	0.10	0.10
query12	0.14	0.11	0.10
query13	0.64	0.61	0.64
query14	1.10	1.06	1.06
query15	0.88	0.87	0.87
query16	0.42	0.42	0.38
query17	1.11	1.14	1.14
query18	0.23	0.21	0.21
query19	2.11	1.93	2.01
query20	0.02	0.01	0.01
query21	15.39	0.27	0.16
query22	5.13	0.06	0.06
query23	16.09	0.29	0.11
query24	2.54	0.51	0.19
query25	0.09	0.10	0.06
query26	0.14	0.14	0.15
query27	0.06	0.05	0.05
query28	4.60	1.13	0.97
query29	12.59	3.87	3.19
query30	0.29	0.14	0.11
query31	2.81	0.66	0.41
query32	3.24	0.59	0.50
query33	3.20	3.22	3.26
query34	16.30	5.36	4.76
query35	4.84	4.76	4.74
query36	0.65	0.49	0.49
query37	0.12	0.07	0.07
query38	0.08	0.05	0.04
query39	0.04	0.02	0.02
query40	0.19	0.16	0.16
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 100.03 s
Total hot run time: 28.24 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 8.33% (1/12) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 100.00% (9/9) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.77% (19474/36906)
Line Coverage 36.25% (181445/500551)
Region Coverage 32.64% (140753/431234)
Branch Coverage 33.66% (61013/181274)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (9/9) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.71% (25931/36161)
Line Coverage 54.32% (271226/499312)
Region Coverage 51.69% (225184/435613)
Branch Coverage 53.22% (96856/181978)

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 91.67% (11/12) 🎉
Increment coverage report
Complete coverage report

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 Feb 12, 2026
@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.

@zclllyybb zclllyybb added usercase Important user case type label dev/3.0.x dev/3.1.x dev/4.0.x and removed approved Indicates a PR has been approved by one committer. reviewed labels Feb 12, 2026
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 12, 2026
@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.

@yiguolei yiguolei merged commit 5699e26 into apache:master Feb 12, 2026
35 of 36 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 12, 2026
### What problem does this PR solve?

Issue Number: close #xxx

Related PR: 

### Release note

doc: apache/doris-website#3390

Given an input date value, return the date of the day of the week before
it.
```text
Doris> select previous_day('2023-04-06', 'Monday');
+--------------------------------------+
| previous_day('2023-04-06', 'Monday') |
+--------------------------------------+
| 2023-04-03                           |
+--------------------------------------+
1 row in set (0.13 sec)

Doris> select previous_day('2023-04-06', 'Tue');
+-----------------------------------+
| previous_day('2023-04-06', 'Tue') |
+-----------------------------------+
| 2023-04-04                        |
+-----------------------------------+
1 row in set (0.04 sec)

Doris> select previous_day('2023-04-06 20:13:14', 'Fr');
+-------------------------------------------+
| previous_day('2023-04-06 20:13:14', 'Fr') |
+-------------------------------------------+
| 2023-03-31                                |
+-------------------------------------------+
1 row in set (0.04 sec)
```

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
    - [x] Yes. apache/doris-website#3390

### 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 -->
@linrrzqqq linrrzqqq deleted the previoud_day branch February 12, 2026 16:16
yiguolei pushed a commit that referenced this pull request Feb 13, 2026
)

Cherry-picked from #60680

Co-authored-by: linrrarity <linzhenqi@selectdb.com>
zclllyybb pushed a commit that referenced this pull request Feb 14, 2026
github-actions bot pushed a commit that referenced this pull request Feb 14, 2026
ybtsdst pushed a commit to ybtsdst/doris that referenced this pull request Feb 27, 2026
apache#60726)

Cherry-picked from apache#60680

Co-authored-by: linrrarity <linzhenqi@selectdb.com>
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.4-merged reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants