-
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: fix uint type overflow on generated column not compatible with mysql | tidb-test=pr/2088 #40157
executor: fix uint type overflow on generated column not compatible with mysql | tidb-test=pr/2088 #40157
Changes from 1 commit
7aa5f65
f03f276
96e3549
f343e03
45c1d16
1a425cd
b425d03
6244cad
2200fa2
0abb2d7
d1533b3
de0c131
4d49a2e
9570f52
b03b526
97f3078
03df42c
1ab25b1
a86c7e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -691,7 +691,9 @@ func FillVirtualColumnValue(virtualRetTypes []*types.FieldType, virtualColumnInd | |
} | ||
// Because the expression might return different type from | ||
// the generated column, we should wrap a CAST on the result. | ||
sctx.GetSessionVars().StmtCtx.InFillVirtualColumnValue = true | ||
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. Setting it here may cause a data race. FillVirtualColumnValue() can be called concurrently. 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. hi @wjhuang2016 , Can you give me some advice on how to fix it? The core reason is the "ShouldClipToZero",but i have no idea how to solve it properly. 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. I'm afraid there is not a clean way to do it. But we can add a particular check after CastValue() in FillVirtualColumnValue. We can check its type and value, then clip it to 0 if necessary. 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. @wjhuang2016 i'm not very sure how to check it as you mentioned. After CastValue(),it should be a valiad destination type value already,how can judge it properly? 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. You can know its type before CastValue(), and validate its value after CastValue(). If it doesn't obey the |
||
castDatum, err := CastValue(sctx, datum, colInfos[idx], false, true) | ||
sctx.GetSessionVars().StmtCtx.InFillVirtualColumnValue = false | ||
if err != nil { | ||
return err | ||
} | ||
|
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.
Please add more tests, for example, type char, decimal