Skip to content

[branch-2.1](function) fix wrong result when convert_tz is out of bound (#37358) - #38313

Merged
yiguolei merged 1 commit into
apache:branch-2.1from
zclllyybb:pick_convert_tz_21
Jul 25, 2024
Merged

[branch-2.1](function) fix wrong result when convert_tz is out of bound (#37358)#38313
yiguolei merged 1 commit into
apache:branch-2.1from
zclllyybb:pick_convert_tz_21

Conversation

@zclllyybb

Copy link
Copy Markdown
Contributor

Proposed changes

pick #37358

before:

mysql>select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'as DATETIMEV1), cast('Asia/Shanghai'asVARCHAR(65533)), cast('America/Los_Angeles'asVARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001'as DATETIME), cast('Asia/Shanghai'asVARCHAR(65533)), cast('America/Los_Angeles'asVARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-3108:01:19 |
+---------------------------------------------------------------------------------------------------------------------------------------------------+1 row inset (0.12 sec)

now:

mysql>select CONVERT_TZ(cast('0000-01-01 00:00:00.00001'as DATETIMEV1), cast('Asia/Shanghai'asVARCHAR(65533)), cast('America/Los_Angeles'asVARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001'as DATETIME), cast('Asia/Shanghai'asVARCHAR(65533)), cast('America/Los_Angeles'asVARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL |
+---------------------------------------------------------------------------------------------------------------------------------------------------+1 row inset (0.09 sec)

…che#37358)
## Proposed changes
Issue Number: close #xxx
before:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001' as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| q535-12-31 08:01:19 |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.12 sec)
```
now:
```sql
mysql> select CONVERT_TZ(cast('0000-01-01 00:00:00.00001' as DATETIMEV1), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533)));
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| convert_tz(cast('0000-01-01 00:00:00.00001' as DATETIME), cast('Asia/Shanghai' as VARCHAR(65533)), cast('America/Los_Angeles' as VARCHAR(65533))) |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.09 sec)
```
@zclllyybb

Copy link
Copy Markdown
ContributorAuthor

run buildall

@doris-robot

Copy link
Copy Markdown

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -18,19 +18,15 @@
#pragma once

#include <cctz/time_zone.h>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'cctz/time_zone.h' file not found [clang-diagnostic-error]

#include<cctz/time_zone.h>
^

@doris-robot

Copy link
Copy Markdown

TeamCity be ut coverage result:
Function Coverage: 36.48% (9247/25345)
Line Coverage: 28.02% (75624/269862)
Region Coverage: 26.83% (38865/144859)
Branch Coverage: 23.56% (19727/83736)
Coverage Report: http://coverage.selectdb-in.cc/coverage/6d766e7cb316d590b28422f6fa718f92156bd8c4_6d766e7cb316d590b28422f6fa718f92156bd8c4/report/index.html

@yiguolei
yiguolei merged commit 79a6496 into apache:branch-2.1Jul 25, 2024
Sign up for freeto 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.

3 participants

@zclllyybb@doris-robot@yiguolei