-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](datetime) fix datetime round on BE #31205
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
Conversation
|
Thank you for your contribution to Apache Doris. |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
zclllyybb
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. |
TPC-H: Total hot run time: 41273 ms |
|
TeamCity be ut coverage result: |
with tmp as (
select CONCAT(
YEAR('2024-02-06 03:37:07.157'), '-',
LPAD(MONTH('2024-02-06 03:37:07.157'), 2, '0'), '-',
LPAD(DAY('2024-02-06 03:37:07.157'), 2, '0'), ' ',
LPAD(HOUR('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(MINUTE('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(SECOND('2024-02-06 03:37:07.157'), 2, '0'), '.', "123456789" )
AS generated_string)
select generated_string, cast(generated_string as DateTime(6)) from tmp
before (incorrect round)
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123456 |
+-------------------------------+-----------------------------------------+
after (round up, keep consistent with mysql):
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123457 |
+-------------------------------+-----------------------------------------+
1 row in set (0.03 sec)
same work with apache#30744 but implemented on BE
with tmp as (
select CONCAT(
YEAR('2024-02-06 03:37:07.157'), '-',
LPAD(MONTH('2024-02-06 03:37:07.157'), 2, '0'), '-',
LPAD(DAY('2024-02-06 03:37:07.157'), 2, '0'), ' ',
LPAD(HOUR('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(MINUTE('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(SECOND('2024-02-06 03:37:07.157'), 2, '0'), '.', "123456789" )
AS generated_string)
select generated_string, cast(generated_string as DateTime(6)) from tmp
before (incorrect round)
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123456 |
+-------------------------------+-----------------------------------------+
after (round up, keep consistent with mysql):
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123457 |
+-------------------------------+-----------------------------------------+
1 row in set (0.03 sec)
same work with #30744 but implemented on BE
with tmp as (
select CONCAT(
YEAR('2024-02-06 03:37:07.157'), '-',
LPAD(MONTH('2024-02-06 03:37:07.157'), 2, '0'), '-',
LPAD(DAY('2024-02-06 03:37:07.157'), 2, '0'), ' ',
LPAD(HOUR('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(MINUTE('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(SECOND('2024-02-06 03:37:07.157'), 2, '0'), '.', "123456789" )
AS generated_string)
select generated_string, cast(generated_string as DateTime(6)) from tmp
before (incorrect round)
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123456 |
+-------------------------------+-----------------------------------------+
after (round up, keep consistent with mysql):
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123457 |
+-------------------------------+-----------------------------------------+
1 row in set (0.03 sec)
same work with #30744 but implemented on BE
with tmp as (
select CONCAT(
YEAR('2024-02-06 03:37:07.157'), '-',
LPAD(MONTH('2024-02-06 03:37:07.157'), 2, '0'), '-',
LPAD(DAY('2024-02-06 03:37:07.157'), 2, '0'), ' ',
LPAD(HOUR('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(MINUTE('2024-02-06 03:37:07.157'), 2, '0'), ':',
LPAD(SECOND('2024-02-06 03:37:07.157'), 2, '0'), '.', "123456789" )
AS generated_string)
select generated_string, cast(generated_string as DateTime(6)) from tmp
before (incorrect round)
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123456 |
+-------------------------------+-----------------------------------------+
after (round up, keep consistent with mysql):
+-------------------------------+-----------------------------------------+
| generated_string | cast(generated_string as DATETIMEV2(6)) |
+-------------------------------+-----------------------------------------+
| 2024-02-06 03:37:07.123456789 | 2024-02-06 03:37:07.123457 |
+-------------------------------+-----------------------------------------+
1 row in set (0.03 sec)
same work with apache#30744 but implemented on BE
before (incorrect round)
after (round up, keep consistent with mysql):
same work with #30744 but implemented on BE