-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](function) add time type in conditional-functions #41270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix](function) add time type in conditional-functions #41270
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
HappenLee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
before
```
mysql [(none)]>select sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar)));
+---------------------------------------------------------------------------------------+
| sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) |
+---------------------------------------------------------------------------------------+
| 16:00:00 |
+---------------------------------------------------------------------------------------+
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| ifnull(cast(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) as DOUBLE), cast(cast(300 as TIME) as DOUBLE)) |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| 57600000000 |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
```
now
```
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+------------------------------------------------------------------------------------------------------------------+
| ifnull(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))), cast(300 as TIME)) |
+------------------------------------------------------------------------------------------------------------------+
| 16:00:00 |
+------------------------------------------------------------------------------------------------------------------+
```
before
```
mysql [(none)]>select sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar)));
+---------------------------------------------------------------------------------------+
| sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) |
+---------------------------------------------------------------------------------------+
| 16:00:00 |
+---------------------------------------------------------------------------------------+
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| ifnull(cast(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) as DOUBLE), cast(cast(300 as TIME) as DOUBLE)) |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| 57600000000 |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
```
now
```
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+------------------------------------------------------------------------------------------------------------------+
| ifnull(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))), cast(300 as TIME)) |
+------------------------------------------------------------------------------------------------------------------+
| 16:00:00 |
+------------------------------------------------------------------------------------------------------------------+
```
before
```
mysql [(none)]>select sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar)));
+---------------------------------------------------------------------------------------+
| sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) |
+---------------------------------------------------------------------------------------+
| 16:00:00 |
+---------------------------------------------------------------------------------------+
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| ifnull(cast(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) as DOUBLE), cast(cast(300 as TIME) as DOUBLE)) |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| 57600000000 |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
```
now
```
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+------------------------------------------------------------------------------------------------------------------+
| ifnull(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))), cast(300 as TIME)) |
+------------------------------------------------------------------------------------------------------------------+
| 16:00:00 |
+------------------------------------------------------------------------------------------------------------------+
```
before
```
mysql [(none)]>select sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar)));
+---------------------------------------------------------------------------------------+
| sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) |
+---------------------------------------------------------------------------------------+
| 16:00:00 |
+---------------------------------------------------------------------------------------+
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| ifnull(cast(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))) as DOUBLE), cast(cast(300 as TIME) as DOUBLE)) |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
| 57600000000 |
+--------------------------------------------------------------------------------------------------------------------------------------------------+
```
now
```
mysql [(none)]>select ifnull(sec_to_time(time_to_sec(cast('2024-09-24 16:00:00' as varchar))), cast(300 as time));
+------------------------------------------------------------------------------------------------------------------+
| ifnull(sec_to_time(time_to_sec(cast(cast('2024-09-24 16:00:00' as VARCHAR(65533)) as TIME))), cast(300 as TIME)) |
+------------------------------------------------------------------------------------------------------------------+
| 16:00:00 |
+------------------------------------------------------------------------------------------------------------------+
```
Proposed changes
before
now