-
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: Fix incorrect behavior of greatest/least when mixed temporal type with others #31037
Conversation
…add integration tests
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/2fabae472dd2b36ada93cc3566eb6c8d919845e5 |
/run-unit-test |
\run-all-tests |
/run-all-tests |
1 similar comment
/run-all-tests |
/cc @XuHuaiyu @guo-shaoge , create this new PR, since previous forked repo was deleted by mistake. |
/merge |
@yibin87: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/assign @XuHuaiyu , please help to merge this PR |
expression/builtin_compare.go
Outdated
// cmpStringMode: 0 for cmp string directly; 1 for cmp string as date 'yyyy-mm-dd'; 2 for cmp string | ||
// as datetime 'yyyy-mm-dd hh:mm:ss' | ||
// fieldTimeType: the return type, 0 for non-temporary time; 1 for date type; 2 for datetime type | ||
func resolveType4Extremum(args []Expression) (_ types.EvalType, fieldTimeType byte, cmpStringMode int) { |
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.
func resolveType4Extremum(args []Expression) (_ types.EvalType, fieldTimeType byte, cmpStringMode int) { | |
type CmpStringMode uint8 | |
const ( | |
CmpStringDirectly CmpStringMode = iota | |
CmpStringAsDate // 'yyyy-mm-dd' | |
CmpStringAsDatetime // 'yyyy-mm-dd hh:mm:ss' | |
) | |
func resolveType4Extremum(args []Expression) (_ types.EvalType, fieldTimeType byte, cmpStringMode CmpStringMode) { |
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.
the fieldTimeType
can also be extracted as an individual type definition
@@ -945,11 +1014,13 @@ func (b *builtinLeastCmpStringAsTimeSig) evalString(row chunk.Row) (strRes strin | |||
|
|||
type builtinLeastTimeSig struct { |
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.
The vecEvalxxx
of the sig also needs to be fixed.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 2fabae4
|
/run-all-tests |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #31157 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.0 in PR #31158 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.1 in PR #31159 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.2 in PR #31160 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.3 in PR #31161 |
What problem does this PR solve?
Issue Number: close #30264 #30261
Problem Summary:
What is changed and how it works?
Change Greatest/Least builtin function's behavior according to MySQL's.
Check List
Tests
Side effects
Documentation
Release note