-
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
*: fix the flen type datetime for union/case-when/control-funcs #30588
Merged
Merged
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
1a23a74
bugfix: pr-29498
bestwoody 4211a19
Merge branch 'master' of https://github.com/pingcap/tidb
bestwoody 2ba67ac
Merge branch 'pingcap:master' into bugfix29498
bestwoody a9669f3
Merge branch 'master' into bugfix29498
bestwoody 4edd160
add test for issue 29498
bestwoody 6e8db44
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody 5df7239
Merge branch 'master' into bugfix29498
bestwoody 647d015
gofmt
bestwoody 7baf630
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody 04603ea
code refine
bestwoody 474886e
Merge branch 'master' into bugfix29498
bestwoody f2f6bf6
fix test
bestwoody 151edd7
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody 71a8c67
Merge branch 'master' into bugfix29498
bestwoody e818f8d
update
bestwoody 77c192d
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody 6060663
Merge branch 'master' into bugfix29498
bestwoody 4033c2e
Merge branch 'master' into bugfix29498
bestwoody 9832917
Merge branch 'master' into bugfix29498
bestwoody b6a61e8
Merge branch 'master' into bugfix29498
bestwoody b98106d
Merge branch 'master' into bugfix29498
bestwoody f7b6d7c
Merge branch 'master' into bugfix29498
bestwoody c1e43a2
fofmt
bestwoody 09778cd
Merge branch 'master' into bugfix29498
bestwoody a3f77c4
comment format
bestwoody 20ec855
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody e369534
Merge branch 'master' into bugfix29498
bestwoody 4af5cb8
Merge branch 'master' into bugfix29498
bestwoody 0d8b5f9
Merge branch 'master' into bugfix29498
bestwoody 80caa6b
remove useless code
bestwoody 34e2ef0
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody 3054865
also fix cases of union, case_when
bestwoody fc6d156
Merge branch 'master' into bugfix29498
bestwoody 20a6c20
remove duplicated code
bestwoody 859ff44
Merge branch 'bugfix29498' of github.com:bestwoody/tidb into bugfix29498
bestwoody 5c58e8a
update
bestwoody e9a26bc
add comment for export method TryToFixFlenOfDatetime
bestwoody 0e77c27
update
bestwoody 350c838
Merge branch 'master' into bugfix29498
bestwoody File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,19 @@ func AggFieldType(tps []*FieldType) *FieldType { | |
return &currType | ||
} | ||
|
||
// TryToFixFlenOfDatetime try to fix flen of Datetime for specific func or other field merge cases | ||
func TryToFixFlenOfDatetime(resultTp *FieldType) bool { | ||
if resultTp.Tp == mysql.TypeDatetime { | ||
resultTp.Flen = mysql.MaxDatetimeWidthNoFsp | ||
if resultTp.Decimal > 0 { | ||
resultTp.Flen += resultTp.Decimal + 1 | ||
} | ||
return true | ||
} else { | ||
return false | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the returned bool value is useless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
} | ||
|
||
// AggregateEvalType aggregates arguments' EvalType of a multi-argument function. | ||
func AggregateEvalType(fts []*FieldType, flag *uint) EvalType { | ||
var ( | ||
|
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.
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.
Why do we need to return a bool value even if we do not check it ?
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.
removed