-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression: handle builtin time getInterval from Decimal\Real #11479
Conversation
@wshwsh12 @SunRunAway PTAL |
Codecov Report
@@ Coverage Diff @@
## master #11479 +/- ##
================================================
- Coverage 81.5575% 81.3623% -0.1953%
================================================
Files 424 424
Lines 91745 90918 -827
================================================
- Hits 74825 73973 -852
- Misses 11605 11624 +19
- Partials 5315 5321 +6 |
Codecov Report
@@ Coverage Diff @@
## master #11479 +/- ##
===========================================
Coverage 81.3449% 81.3449%
===========================================
Files 424 424
Lines 91053 91053
===========================================
Hits 74067 74067
Misses 11657 11657
Partials 5329 5329 |
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
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
@@ -2652,10 +2652,11 @@ func (du *baseDateArithmitical) getIntervalFromString(ctx sessionctx.Context, ar | |||
} | |||
|
|||
func (du *baseDateArithmitical) getIntervalFromDecimal(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { | |||
interval, isNull, err := args[1].EvalString(ctx, row) | |||
decimal, isNull, err := args[1].EvalDecimal(ctx, 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.
Unexpectedly, we do not have a case to cover this line before. 😢
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.
@XuHuaiyu I add unit test for getIntervalFromDecimal PTAL
tk.MustExec("use test") | ||
tk.MustExec(`drop table if exists t;`) | ||
tk.MustExec(`CREATE TABLE t (a decimal(6,3),b double(6,3),c float(6,3));`) | ||
tk.MustExec(`INSERT INTO t VALUES (1.100,1.100,1.100);`) |
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.
Can we add more complicated 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.
Any Idea...I think type covertion is enough.
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.
decimal(11,7): 123.9999999
, -123.9999999
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.
double(11, 7)
float(11, 7)
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
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
/run-all-tests |
cherry pick to release-3.0 in PR #11527 |
cherry pick to release-2.1 failed |
…p#11479) All tests passed, auto merged by Bot
What problem does this PR solve?
Part of issue #11223, fixes #11309
What is changed and how it works?
Check List
Tests