Repository navigation
*: remove mysql.TypeDecimal #18787
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
*: remove mysql.TypeDecimal #18787
Changes from all commits
c70ecdc
764c0ce
89d998f
f411d58
09d58b8
ddd9e35
9862c7e
61488ec
72be457
8b41c80
c9c0dcc
7359beb
adbef14
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 |
|---|---|---|
|
|
@@ -202,7 +202,7 @@ func getIndexColumnLength(col *model.ColumnInfo, colLen int) (int, error) { | |
| return mysql.DefaultLengthOfMysqlTypes[mysql.TypeFloat], nil | ||
| } | ||
| return mysql.DefaultLengthOfMysqlTypes[mysql.TypeDouble], nil | ||
| case mysql.TypeDecimal, mysql.TypeNewDecimal: | ||
|
Contributor
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. We should remove the TypeDecimal here, it's misuse |
||
| case mysql.TypeNewDecimal: | ||
| return calcBytesLengthForDecimal(length), nil | ||
| case mysql.TypeYear, mysql.TypeDate, mysql.TypeDuration, mysql.TypeDatetime, mysql.TypeTimestamp: | ||
| return mysql.DefaultLengthOfMysqlTypes[col.Tp], nil | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,7 +253,7 @@ func (s *testEvaluatorSuite) TestCastXXX(c *C) { | |
|
|
||
| // cast(bad_string as decimal) | ||
| for _, s := range []string{"hello", ""} { | ||
| f = BuildCastFunction(ctx, &Constant{Value: types.NewDatum(s), RetType: types.NewFieldType(mysql.TypeDecimal)}, tp) | ||
|
Contributor
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. This needs to be changed to TypeNewDecimal |
||
| f = BuildCastFunction(ctx, &Constant{Value: types.NewDatum(s), RetType: types.NewFieldType(mysql.TypeNewDecimal)}, tp) | ||
| res, err = f.Eval(chunk.Row{}) | ||
| c.Assert(err, IsNil) | ||
| } | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4867,7 +4867,7 @@ func (c *timestampFunctionClass) getFunction(ctx sessionctx.Context, args []Expr | |
| } | ||
| isFloat := false | ||
| switch args[0].GetType().Tp { | ||
| case mysql.TypeFloat, mysql.TypeDouble, mysql.TypeDecimal: | ||
|
Contributor
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. We need to change this TypeDecimal to TypeNewDecimal |
||
| case mysql.TypeFloat, mysql.TypeDouble, mysql.TypeNewDecimal: | ||
| isFloat = true | ||
| } | ||
| bf, err := newBaseBuiltinFuncWithTp(ctx, c.funcName, args, types.ETDatetime, evalTps...) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,7 +147,6 @@ func (s *testEvaluatorSuite) TestColumn2Pb(c *C) { | |
| 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)) | ||
|
Contributor
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. Why remove this?
Contributor
Author
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. Since if
Contributor
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. Maybe we can change this TypeDecimal to TypeNewDecimal?
Contributor
Author
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. Emmmm... The test for |
||
|
|
||
| pushed, remained := PushDownExprs(sc, colExprs, client, kv.UnSpecified) | ||
| c.Assert(len(pushed), Equals, 0) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -379,8 +379,8 @@ var vecBuiltin{{ .Category }}GeneratedCases = map[string][]vecExprBenchCase { | |
| {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)}, | ||
|
Contributor
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. This should be changed to TypeNewDecimal |
||
| {Value: types.NewDecimalDatum(types.NewDecFromInt(20)), RetType: types.NewFieldType(mysql.TypeDecimal)}, | ||
|
Contributor
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. This should be changed to TypeNewDecimal |
||
| {Value: types.NewDecimalDatum(types.NewDecFromInt(10)), RetType: types.NewFieldType(mysql.TypeNewDecimal)}, | ||
| {Value: types.NewDecimalDatum(types.NewDecFromInt(20)), RetType: types.NewFieldType(mysql.TypeNewDecimal)}, | ||
| {{- end }} | ||
| }, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,7 @@ func IsTypeTime(tp byte) bool { | |
| 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: | ||
|
Contributor
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. We should change this to TypeNewDecimal |
||
| mysql.TypeFloat, mysql.TypeDouble, mysql.TypeShort: | ||
| return true | ||
| } | ||
| return false | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -323,8 +323,8 @@ func (s *testTypeEtcSuite) TestIsTypeNumeric(c *C) { | |
| res = IsTypeNumeric(mysql.TypeNewDecimal) | ||
| c.Assert(res, Equals, true) | ||
|
|
||
| res = IsTypeNumeric(mysql.TypeDecimal) | ||
|
Contributor
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. We should change this to TypeNewDecimal |
||
| c.Assert(res, Equals, true) | ||
| res = IsTypeNumeric(mysql.TypeUnspecified) | ||
| c.Assert(res, Equals, false) | ||
|
|
||
| res = IsTypeNumeric(mysql.TypeFloat) | ||
| c.Assert(res, Equals, true) | ||
|
|
||
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 should remove the TypeDecimal here, it's misuse
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.
revert done, thx~
ditto.