Repository navigation
*: remove mysql.TypeDecimal - #18787
Conversation
Signed-off-by: Wang Ruichao <wangruichao2014@xiaochuankeji.cn>
Signed-off-by: Wang Ruichao <wangruichao2014@xiaochuankeji.cn>
Codecov Report
@@ Coverage Diff @@
## master #18787 +/- ##
===========================================
Coverage 79.4066% 79.4066%
===========================================
Files 545 545
Lines 148922 148922
===========================================
Hits 118254 118254
Misses 21246 21246
Partials 9422 9422 |
Signed-off-by: Wang Ruichao <wangruichao2014@xiaochuankeji.cn>
|
Note that in my opinion some |
|
|
||
| data = append(data, '\'') | ||
| return string(data), nil | ||
| case mysql.TypeNewDecimal, mysql.TypeDecimal: |
There was a problem hiding this comment.
We should remove the TypeDecimal here, it's misuse
There was a problem hiding this comment.
revert done, thx~
ditto.
| return mysql.DefaultLengthOfMysqlTypes[mysql.TypeFloat], nil | ||
| } | ||
| return mysql.DefaultLengthOfMysqlTypes[mysql.TypeDouble], nil | ||
| case mysql.TypeDecimal, mysql.TypeNewDecimal: |
There was a problem hiding this comment.
We should remove the TypeDecimal here, it's misuse
| } | ||
| isFloat := false | ||
| switch args[0].GetType().Tp { | ||
| case mysql.TypeFloat, mysql.TypeDouble, mysql.TypeDecimal: |
There was a problem hiding this comment.
We need to change this TypeDecimal to TypeNewDecimal
| {Value: types.NewFloat64Datum(0.2), RetType: types.NewFieldType(mysql.TypeFloat)}, | ||
| {{- end }} | ||
| {{- if eq .Input.ETName "Decimal" }} | ||
| {Value: types.NewDecimalDatum(types.NewDecFromInt(10)), RetType: types.NewFieldType(mysql.TypeDecimal)}, |
There was a problem hiding this comment.
This should be changed to TypeNewDecimal
| {{- end }} | ||
| {{- if eq .Input.ETName "Decimal" }} | ||
| {Value: types.NewDecimalDatum(types.NewDecFromInt(10)), RetType: types.NewFieldType(mysql.TypeDecimal)}, | ||
| {Value: types.NewDecimalDatum(types.NewDecFromInt(20)), RetType: types.NewFieldType(mysql.TypeDecimal)}, |
There was a problem hiding this comment.
This should be changed to TypeNewDecimal
| func IsTypeNumeric(tp byte) bool { | ||
| switch tp { | ||
| case mysql.TypeBit, mysql.TypeTiny, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong, mysql.TypeNewDecimal, | ||
| mysql.TypeDecimal, mysql.TypeFloat, mysql.TypeDouble, mysql.TypeShort: |
There was a problem hiding this comment.
We should change this to TypeNewDecimal
| res = IsTypeNumeric(mysql.TypeNewDecimal) | ||
| c.Assert(res, Equals, true) | ||
|
|
||
| res = IsTypeNumeric(mysql.TypeDecimal) |
There was a problem hiding this comment.
We should change this to TypeNewDecimal
| @@ -763,7 +763,7 @@ var fieldTypeMergeRules = [fieldTypeNum][fieldTypeNum]byte{ | |||
| /* mysql.TypeYear -> */ | |||
| { | |||
| //mysql.TypeDecimal mysql.TypeTiny | |||
There was a problem hiding this comment.
This comment also need to be changed
|
|
||
| // cast(bad_string as decimal) | ||
| for _, s := range []string{"hello", ""} { | ||
| f = BuildCastFunction(ctx, &Constant{Value: types.NewDatum(s), RetType: types.NewFieldType(mysql.TypeDecimal)}, tp) |
There was a problem hiding this comment.
This needs to be changed to TypeNewDecimal
Signed-off-by: Wang Ruichao <wangruichao2014@xiaochuankeji.cn>
| colExprs = append(colExprs, dg.genColumn(mysql.TypeEnum, 3)) | ||
| colExprs = append(colExprs, dg.genColumn(mysql.TypeGeometry, 4)) | ||
| colExprs = append(colExprs, dg.genColumn(mysql.TypeUnspecified, 5)) | ||
| colExprs = append(colExprs, dg.genColumn(mysql.TypeDecimal, 6)) |
There was a problem hiding this comment.
Since if mysql.TypeDecimal is replaced into mysql.TypeUnspecified, the test will duplicate.
There was a problem hiding this comment.
Maybe we can change this TypeDecimal to TypeNewDecimal?
There was a problem hiding this comment.
Emmmm... The test for mysql.TypeNewDecimal has been added in the following code. Add it will also duplicate.
|
@wangggong We should update the parser dependency through |
done, thx~ However there're some structs deleted in |
|
/run-all-tests |
|
|
/run-all-tests |
|
/run-integration-compatibility-test |
|
/run-check_dev |
|
there is some max display length problem in TiDB-Test repo, I've added a parser variable to control the behavior. Focusing on pingcap/parser#949, update your parser again when it merged. Thanks |
|
go get -v github.com/pingcap/parser@5fe0b0fdf629026232c91b80ea50e734315bf9e3 Hi~ pls update the parser to pass the failed tests. |
|
/run-all-tests |
Signed-off-by: Wang Ruichao <wangruichao2014@xiaochuankeji.cn>
OK, done~ |
|
/run-all-tests |
|
/run-integration-compatibility-test |
|
/run-integration-copr-test |
|
/run-integration-compatibility-test |
|
/run-integration-common-test |
|
/rebuild |
|
/run-all-tests |
|
/run-unit-test |
|
The CI failure seems nothing to do with this PR. |
Signed-off-by: Wang Ruichao wangruichao2014@xiaochuankeji.cn
What problem does this PR solve?
close pingcap/parser#767
cc #15328
Problem Summary:
What is changed and how it works?
What's Changed:
Remove mysql.TypeDecimal, instead mysql.TypeNewDecimal / mysql.TypeUnspecified is used.
Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
Release note
Nope. Please tell me if there's any test to add or code to modify. Thanks.