expression: add implicit eval int and real for function dayname (#21806)#21850
Merged
qw4990 merged 5 commits intopingcap:release-4.0from Jan 27, 2021
Merged
expression: add implicit eval int and real for function dayname (#21806)#21850qw4990 merged 5 commits intopingcap:release-4.0from
qw4990 merged 5 commits intopingcap:release-4.0from
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
@zanmato1984 you're already a collaborator in bot's repo. |
qw4990
reviewed
Jan 26, 2021
| isZero := allocZeroSlice(n) | ||
| defer deallocateZeroSlice(isZero) | ||
| for _, expr := range exprList { | ||
| <<<<<<< HEAD |
Contributor
|
Could you please help to resolve conflicts? @ichn-hu @lzmhhh123 |
Contributor
|
/run-all-tests |
Contributor
|
/run-all-tests |
Contributor
|
/run-unit-test |
2 similar comments
Contributor
|
/run-unit-test |
Contributor
|
/run-unit-test |
lzmhhh123
approved these changes
Jan 27, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cherry-pick #21806 to release-4.0
What problem does this PR solve?
Issue Number: close #19992
Problem Summary:
It's a bit long story.
MySQL has a weird behavior about function
dayname()(IMO this apparently is a MySQL defect):It evaluates as integer directly despite the function signature is actually string. Quoted of comments in MySQL source code:
PR #9975 fixed this issue by removing the implicit cast from
dayname()string to int/real, however introduced a more obvious bug:As shown above, unconditionally removing implicit cast gave the wrong result for non-arithmetic expressions involving function
dayname().What is changed and how it works?
What's Changed:
Don't use
hasSpecialCastsanymore. Instead, markdayname()asCanImplicitEvalInt/Real, and do "implicit"evalInt/Realin the actualcastfunctions.Besides, since filter operator has its own path to evaluate expressions into boolean, modify it too to do "implicit"
evalInt/Real.How it Works:
Adding implicit
evalInt/Realpath makescastfunctions directly evaluatedayname()as int/real, which further involve into whatever evaluation in the upper level of the expression tree.Related changes
pingcap/docs/pingcap/docs-cn: noneCheck List
Tests
Side effects
Release note
dayname