-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature] add function of date_diff in multi actions #26415
Conversation
8a88b5d
to
e5a646e
Compare
cc @silverbullet233 have a review plz |
cae0641
to
2ef2c47
Compare
select date_diff("2010-11-30 23:59:59", "2010-11-30 20:58:59", "hour"); | ||
select date_diff("2010-11-30 23:59:59", "2010-11-30 20:58:59", "minute"); | ||
select date_diff("2010-11-30 23:59:59", "2010-11-30 20:59:59", "second"); | ||
|
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.
need more stronger test cases, such as parameters with more precision and some corner cases, such as SELECT date_diff('2020-03-01 00:00:05.000001','2020-03-02 00:00:05',day');
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.
ok,had add more precision cases
92cee60
to
ff98036
Compare
be/src/exprs/time_functions.cpp
Outdated
TimestampValue l = (TimestampValue)lv_column.value(row); | ||
TimestampValue r = (TimestampValue)rv_column.value(row); |
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.
what if the value is NULL?
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.
if the value is NULL,would return NULL
@@ -197,6 +197,29 @@ select dayofweek_iso("2023-01-03"); | |||
select dayofweek_iso(""); | |||
select dayofweek_iso(NULL); | |||
|
|||
-- name: test_date_diff |
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.
plz add some test cases that the parameters contain NULL and the third paramter is not invalid
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.
i had add testcase contained NULL,and if third paramter is valid would report a error like the picture:
mysql> select date_diff("2010-11-30 23:59:59", "2010-11-30 20:59:59", "aaa");
ERROR 1064 (HY000): Expr evaluate meet error: type column should be one of day/hour/minute/second/millisecond
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.
i had add testcase contained NULL,and if third paramter is valid would report a error like the picture: mysql> select date_diff("2010-11-30 23:59:59", "2010-11-30 20:59:59", "aaa"); ERROR 1064 (HY000): Expr evaluate meet error: type column should be one of day/hour/minute/second/millisecond
should be added in test cases
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.
get,had add this to testcases
2a6a0bf
to
ea00d17
Compare
} | ||
ColumnPtr column = context->get_constant_column(2); | ||
auto type_str = ColumnHelper::get_const_value<TYPE_VARCHAR>(column); | ||
if (type_str != "day" && type_str != "hour" && type_str != "minute" && type_str != "second" && |
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.
compare ignore case ?
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.
done
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
Signed-off-by: xuzifu666 <[email protected]>
[FE PR Coverage Check]😍 pass : 0 / 0 (0%) |
@mergify backport branch-3.0 branch-3.1 |
✅ Backports have been created
|
Fixes [StarRocks#23420](StarRocks#23420) Signed-off-by: Zhuhe Fang <[email protected]>
Fixes #23420
What type of PR is this:
Checklist:
Bugfix cherry-pick branch check: