-
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
executor, util: wrap cast upon the args for AggFunction #7180
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
35ec041
executor, util: wrap cast upon the args for AggFunction
XuHuaiyu 64755f4
address comment
XuHuaiyu 4b91a24
address comment
XuHuaiyu 29edfd9
Merge branch 'master' of https://github.com/pingcap/tidb into agg_type
XuHuaiyu 4d682dc
Merge branch 'master' into agg_type
XuHuaiyu 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,7 +189,15 @@ func (r Row) GetDatum(colIdx int, tp *types.FieldType) types.Datum { | |
if !r.IsNull(colIdx) { | ||
d.SetMysqlDecimal(r.GetMyDecimal(colIdx)) | ||
d.SetLength(tp.Flen) | ||
d.SetFrac(tp.Decimal) | ||
// If tp.Decimal is unspecified(-1), we should set it to the real | ||
// fraction length of the decimal value, if not, the d.Frac will | ||
// be set to MAX_UINT16 which will cause unexpected BadNumber error | ||
// when encoding. | ||
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. Please make the block comment looks like a "block", you can take "llvm", "impala" or any other projects as examples: |
||
if tp.Decimal == types.UnspecifiedLength { | ||
d.SetFrac(d.Frac()) | ||
} else { | ||
d.SetFrac(tp.Decimal) | ||
} | ||
} | ||
case mysql.TypeEnum: | ||
if !r.IsNull(colIdx) { | ||
|
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.
We'd better make implement a function like
InferArgumentType
forAggFuncDesc
, and call that function inside this routine: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 think current function name may be clearer,
since this is not a
real
type infer.Type infer for agg function has been done in AggFuncDesc.typeInfer.
This function is more like a supplementary behavior for type infer.