Skip to content

[Fix](cast) Fix wrong corner case of datetime conversion about timezone convert - #57422

Merged
zclllyybb merged 1 commit into
apache:masterfrom
zclllyybb:datetime_overflow
Oct 29, 2025
Merged

[Fix](cast) Fix wrong corner case of datetime conversion about timezone convert#57422
zclllyybb merged 1 commit into
apache:masterfrom
zclllyybb:datetime_overflow

Conversation

@zclllyybb

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

before:

mysql>select cast('9999-12-31 23:59:59.999999 +00:00'as datetime(6));
+----------------------------------------------------------+
| cast('9999-12-31 23:59:59.999999 +00:00'as datetime(6)) |
+----------------------------------------------------------+
| |
+----------------------------------------------------------+

now:

mysql>select cast('9999-12-31 23:59:59.999999 +00:00'as datetime(6));
+----------------------------------------------------------+
| cast('9999-12-31 23:59:59.999999 +00:00'as datetime(6)) |
+----------------------------------------------------------+
| NULL |
+----------------------------------------------------------+

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

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
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

BE UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage52.76% (18056/34224)
Line Coverage37.99% (163732/430954)
Region Coverage32.37% (124821/385552)
Branch Coverage33.74% (54571/161735)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.38% (23934/33529)
Line Coverage57.79% (248922/430755)
Region Coverage52.80% (206068/390267)
Branch Coverage54.55% (88650/162508)

@zclllyybb

Copy link
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

BE UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage52.75% (18058/34231)
Line Coverage37.99% (163730/431028)
Region Coverage32.36% (124783/385654)
Branch Coverage33.72% (54559/161777)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage71.38% (23937/33536)
Line Coverage57.81% (249074/430836)
Region Coverage52.99% (206872/390419)
Branch Coverage54.67% (88867/162560)

@zclllyybb

Copy link
Copy Markdown
ContributorAuthor

run performance

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Oct 29, 2025
@github-actions

Copy link
Copy Markdown
Contributor

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

@doris-robot

Copy link
Copy Markdown
ClickBench: Total hot run time: 28.03 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit ee92dc1d563f74f4f7b6c8a59e9d77b0fe59ec68, data reload: false
query1	0.06	0.05	0.05
query2	0.10	0.06	0.05
query3	0.26	0.09	0.09
query4	1.60	0.12	0.12
query5	0.28	0.26	0.26
query6	1.18	0.67	0.64
query7	0.03	0.03	0.02
query8	0.05	0.04	0.04
query9	0.64	0.54	0.52
query10	0.57	0.58	0.57
query11	0.16	0.11	0.11
query12	0.15	0.12	0.12
query13	0.62	0.61	0.60
query14	1.02	1.05	1.03
query15	0.87	0.84	0.87
query16	0.39	0.39	0.40
query17	1.06	1.07	1.07
query18	0.22	0.21	0.21
query19	1.93	1.82	1.83
query20	0.02	0.01	0.01
query21	15.47	0.20	0.14
query22	5.08	0.07	0.05
query23	15.66	0.27	0.10
query24	2.81	0.59	0.78
query25	0.08	0.06	0.06
query26	0.15	0.14	0.12
query27	0.07	0.06	0.06
query28	5.01	1.16	0.94
query29	12.58	4.05	3.37
query30	0.29	0.13	0.11
query31	2.82	0.61	0.38
query32	3.24	0.55	0.47
query33	3.05	3.05	3.04
query34	15.81	5.18	4.54
query35	4.61	4.63	4.63
query36	0.69	0.51	0.50
query37	0.10	0.07	0.07
query38	0.07	0.05	0.04
query39	0.04	0.03	0.03
query40	0.17	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.04	0.03
query43	0.04	0.04	0.03
Total cold run time: 99.18 s
Total hot run time: 28.03 s

@zclllyybb
zclllyybb merged commit 412efb1 into apache:masterOct 29, 2025
27 of 28 checks passed
@zclllyybb
zclllyybb deleted the datetime_overflow branch October 29, 2025 04:22
github-actionsBot pushed a commit that referenced this pull request Oct 29, 2025
…ne convert (#57422)
before:
```sql
mysql> select cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6));
+----------------------------------------------------------+
| cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6)) |
+----------------------------------------------------------+
| |
+----------------------------------------------------------+
```
now:
```sql
mysql> select cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6));
+----------------------------------------------------------+
| cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6)) |
+----------------------------------------------------------+
| NULL |
+----------------------------------------------------------+
```
yiguolei pushed a commit that referenced this pull request Oct 30, 2025
…about timezone convert #57422 (#57442)
Cherry-picked from #57422
Co-authored-by: zclllyybb <zhaochangle@selectdb.com>
dwdwqfwe pushed a commit to dwdwqfwe/doris that referenced this pull request Oct 31, 2025
…ne convert (apache#57422)
before:
```sql
mysql> select cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6));
+----------------------------------------------------------+
| cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6)) |
+----------------------------------------------------------+
| |
+----------------------------------------------------------+
```
now:
```sql
mysql> select cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6));
+----------------------------------------------------------+
| cast('9999-12-31 23:59:59.999999 +00:00' as datetime(6)) |
+----------------------------------------------------------+
| NULL |
+----------------------------------------------------------+
```
@yiguoleiyiguolei mentioned this pull request Nov 5, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/4.0.1-mergedreviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@zclllyybb@Thearas@doris-robot@hello-stephen@BiteTheDDDDt@Mryange@yiguolei