Skip to content

[fix](datetime) throw exception for date_floor/ceil instead of return NULL#60633

Merged
zclllyybb merged 1 commit intoapache:masterfrom
zclllyybb:floor_ceil_error
Feb 10, 2026
Merged

[fix](datetime) throw exception for date_floor/ceil instead of return NULL#60633
zclllyybb merged 1 commit intoapache:masterfrom
zclllyybb:floor_ceil_error

Conversation

@zclllyybb
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

before:

select date_floor('2007-01-02', interval 0 month);
+--------------------------------------------+
| date_floor('2007-01-02', interval 0 month) |
+--------------------------------------------+
| NULL                                       |
+--------------------------------------------+

now:

select date_floor('2007-01-02', interval 0 month);
Operation month_floor of 2007-01-02 00:00:00, 0, 0001-01-01 00:00:00 out of range

Release note

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?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

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

@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Feb 10, 2026

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
Copy link
Copy Markdown
Contributor Author

run buildall

@doris-robot
Copy link
Copy Markdown

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

------ Round 1 ----------------------------------
q1	17619	4467	4264	4264
q2	2038	350	249	249
q3	10154	1281	739	739
q4	10196	769	311	311
q5	7560	2211	1905	1905
q6	199	182	148	148
q7	873	738	618	618
q8	9263	1412	1097	1097
q9	4710	4631	4584	4584
q10	6823	1926	1537	1537
q11	501	303	299	299
q12	333	374	222	222
q13	17783	4058	3224	3224
q14	230	243	222	222
q15	883	818	811	811
q16	675	667	604	604
q17	691	791	544	544
q18	6561	5767	5802	5767
q19	1300	985	618	618
q20	512	498	387	387
q21	2575	1851	1782	1782
q22	351	314	285	285
Total cold run time: 101830 ms
Total hot run time: 30217 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4372	4328	4339	4328
q2	260	333	275	275
q3	2134	2728	2260	2260
q4	1418	1745	1293	1293
q5	4258	4180	4234	4180
q6	218	174	135	135
q7	1886	1795	1665	1665
q8	2457	2744	2491	2491
q9	7679	7749	7489	7489
q10	2969	3114	2686	2686
q11	562	491	464	464
q12	697	783	619	619
q13	4001	4446	3685	3685
q14	331	323	287	287
q15	890	818	795	795
q16	672	759	671	671
q17	1138	1314	1396	1314
q18	8134	7750	8202	7750
q19	903	888	832	832
q20	2098	2131	1984	1984
q21	4744	4411	4101	4101
q22	567	549	503	503
Total cold run time: 52388 ms
Total hot run time: 49807 ms

@doris-robot
Copy link
Copy Markdown

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

query1	0.06	0.05	0.05
query2	0.10	0.05	0.05
query3	0.26	0.08	0.08
query4	1.60	0.11	0.11
query5	0.26	0.26	0.25
query6	1.17	0.68	0.68
query7	0.04	0.02	0.02
query8	0.06	0.04	0.04
query9	0.57	0.51	0.48
query10	0.56	0.56	0.54
query11	0.14	0.09	0.10
query12	0.14	0.11	0.10
query13	0.63	0.62	0.62
query14	1.08	1.05	1.05
query15	0.87	0.87	0.87
query16	0.41	0.42	0.38
query17	1.09	1.15	1.14
query18	0.22	0.21	0.21
query19	2.05	1.94	1.94
query20	0.01	0.01	0.01
query21	15.43	0.27	0.15
query22	5.19	0.05	0.05
query23	15.95	0.29	0.11
query24	1.70	0.31	0.59
query25	0.12	0.08	0.10
query26	0.13	0.14	0.13
query27	0.07	0.09	0.05
query28	4.69	1.16	0.97
query29	12.56	3.96	3.17
query30	0.28	0.14	0.11
query31	2.82	0.67	0.40
query32	3.23	0.60	0.52
query33	3.28	3.26	3.23
query34	16.13	5.48	4.76
query35	4.80	4.80	4.77
query36	0.65	0.50	0.48
query37	0.10	0.07	0.07
query38	0.07	0.04	0.04
query39	0.04	0.03	0.03
query40	0.20	0.16	0.16
query41	0.09	0.03	0.03
query42	0.05	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 98.94 s
Total hot run time: 28.4 s

Copy link
Copy Markdown
Contributor

@HappenLee HappenLee 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 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (2/2) 🎉
Increment coverage report
Complete coverage report

@zclllyybb zclllyybb merged commit 3bf3bc2 into apache:master Feb 10, 2026
32 of 33 checks passed
@zclllyybb zclllyybb deleted the floor_ceil_error branch February 10, 2026 07:09
github-actions bot pushed a commit that referenced this pull request Feb 10, 2026
… NULL (#60633)

before:
```
select date_floor('2007-01-02', interval 0 month);
+--------------------------------------------+
| date_floor('2007-01-02', interval 0 month) |
+--------------------------------------------+
| NULL                                       |
+--------------------------------------------+
```
now:
```sql
select date_floor('2007-01-02', interval 0 month);
Operation month_floor of 2007-01-02 00:00:00, 0, 0001-01-01 00:00:00 out of range
```
yiguolei pushed a commit that referenced this pull request Feb 10, 2026
…ad of return NULL #60633 (#60640)

Cherry-picked from #60633

Co-authored-by: zclllyybb <zhaochangle@selectdb.com>
ybtsdst pushed a commit to ybtsdst/doris that referenced this pull request Feb 27, 2026
…ad of return NULL apache#60633 (apache#60640)

Cherry-picked from apache#60633

Co-authored-by: zclllyybb <zhaochangle@selectdb.com>
@yiguolei yiguolei mentioned this pull request Mar 7, 2026
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 kind/behavior-changed reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants