mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-09 18:59:12 -06:00
fix decimal result print (#4683)
This commit is contained in:
@@ -56,7 +56,7 @@ require (
|
||||
require (
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.5+incompatible
|
||||
github.com/cenkalti/backoff/v4 v4.1.3
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221108002944-b3b9500beade
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221108230516-e01813bce3c6
|
||||
github.com/google/flatbuffers v2.0.6+incompatible
|
||||
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
|
||||
@@ -178,8 +178,8 @@ github.com/dolthub/flatbuffers v1.13.0-dh.1 h1:OWJdaPep22N52O/0xsUevxJ6Qfw1M2txC
|
||||
github.com/dolthub/flatbuffers v1.13.0-dh.1/go.mod h1:CorYGaDmXjHz1Z7i50PYXG1Ricn31GcA2wNOTFIQAKE=
|
||||
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
|
||||
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221108002944-b3b9500beade h1:+XVUmAsB/hnuSFrAuj1xhftWRjvwgukvx94VEFQqSsU=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221108002944-b3b9500beade/go.mod h1:KtpU4Sf7J+SIat/nxoA733QTn3tdL34NtoGxEBFcTsA=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221108230516-e01813bce3c6 h1:1JK0RC1KejM7W2f1BgSlXoPC6AgPCsdBptUH8otpGQE=
|
||||
github.com/dolthub/go-mysql-server v0.14.1-0.20221108230516-e01813bce3c6/go.mod h1:KtpU4Sf7J+SIat/nxoA733QTn3tdL34NtoGxEBFcTsA=
|
||||
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371 h1:oyPHJlzumKta1vnOQqUnfdz+pk3EmnHS3Nd0cCT0I2g=
|
||||
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371/go.mod h1:dhGBqcCEfK5kuFmeO5+WOx3hqc1k3M29c1oS/R7N4ms=
|
||||
github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474 h1:xTrR+l5l+1Lfq0NvhiEsctylXinUMFhhsqaEcl414p8=
|
||||
|
||||
@@ -100,10 +100,10 @@ func getSqlTypes() []sql.Type {
|
||||
//sql.Blob, //BLOB
|
||||
sql.Boolean, //BOOLEAN
|
||||
sql.MustCreateStringWithDefaults(sqltypes.Char, 10), //CHAR(10)
|
||||
sql.Date, //DATE
|
||||
sql.Datetime, //DATETIME
|
||||
sql.MustCreateDecimalType(9, 5), //DECIMAL(9, 5)
|
||||
sql.Float64, //DOUBLE
|
||||
sql.Date, //DATE
|
||||
sql.Datetime, //DATETIME
|
||||
sql.MustCreateColumnDecimalType(9, 5), //DECIMAL(9, 5)
|
||||
sql.Float64, //DOUBLE
|
||||
sql.MustCreateEnumType([]string{"a", "b", "c"}, sql.Collation_Default), //ENUM('a','b','c')
|
||||
sql.Float32, //FLOAT
|
||||
sql.Int32, //INT
|
||||
|
||||
@@ -59,7 +59,7 @@ func CreateDecimalTypeFromParams(params map[string]string) (TypeInfo, error) {
|
||||
} else {
|
||||
return nil, fmt.Errorf(`create decimal type info is missing param "%v"`, decimalTypeParam_Scale)
|
||||
}
|
||||
sqlDecimalType, err := sql.CreateDecimalType(precision, scale)
|
||||
sqlDecimalType, err := sql.CreateColumnDecimalType(precision, scale)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ func TestDecimalMarshal(t *testing.T) {
|
||||
"16976349273982359874209023948672021737840592720387475.271912873754", false},
|
||||
{65, 12, "99999999999999999999999999999999999999999999999999999.9999999999999", "", true},
|
||||
|
||||
{20, 10, []byte{32}, "", true},
|
||||
{20, 10, []byte{32}, "32", false},
|
||||
{20, 10, time.Date(2019, 12, 12, 12, 12, 12, 0, time.UTC), "", true},
|
||||
}
|
||||
|
||||
|
||||
@@ -546,29 +546,34 @@ func BasicSelectTests() []SelectTest {
|
||||
ExpectedSchema: CompressSchema(PeopleTestSchema),
|
||||
},
|
||||
{
|
||||
Name: "select *, binary + in where type mismatch",
|
||||
Query: "select * from people where first_name + 1 = 41",
|
||||
ExpectedErr: "Type mismatch evaluating expression 'first_name + 1'",
|
||||
Name: "select *, binary + in where type mismatch",
|
||||
Query: "select * from people where first_name + 1 = 41",
|
||||
ExpectedRows: ToSqlRows(PeopleTestSchema),
|
||||
ExpectedSchema: CompressSchema(PeopleTestSchema),
|
||||
},
|
||||
{
|
||||
Name: "select *, binary - in where type mismatch",
|
||||
Query: "select * from people where first_name - 1 = 39",
|
||||
ExpectedErr: "Type mismatch evaluating expression 'first_name - 1'",
|
||||
Name: "select *, binary - in where type mismatch",
|
||||
Query: "select * from people where first_name - 1 = 39",
|
||||
ExpectedRows: ToSqlRows(PeopleTestSchema),
|
||||
ExpectedSchema: CompressSchema(PeopleTestSchema),
|
||||
},
|
||||
{
|
||||
Name: "select *, binary / in where type mismatch",
|
||||
Query: "select * from people where first_name / 2 = 20",
|
||||
ExpectedErr: "Type mismatch evaluating expression 'first_name / 2'",
|
||||
Name: "select *, binary / in where type mismatch",
|
||||
Query: "select * from people where first_name / 2 = 20",
|
||||
ExpectedRows: ToSqlRows(PeopleTestSchema),
|
||||
ExpectedSchema: CompressSchema(PeopleTestSchema),
|
||||
},
|
||||
{
|
||||
Name: "select *, binary * in where type mismatch",
|
||||
Query: "select * from people where first_name * 2 = 80",
|
||||
ExpectedErr: "Type mismatch evaluating expression 'first_name * 2'",
|
||||
Name: "select *, binary * in where type mismatch",
|
||||
Query: "select * from people where first_name * 2 = 80",
|
||||
ExpectedRows: ToSqlRows(PeopleTestSchema),
|
||||
ExpectedSchema: CompressSchema(PeopleTestSchema),
|
||||
},
|
||||
{
|
||||
Name: "select *, binary % in where type mismatch",
|
||||
Query: "select * from people where first_name % 4 = 0",
|
||||
ExpectedErr: "Type mismatch evaluating expression 'first_name % 4'",
|
||||
Name: "select *, binary % in where type mismatch",
|
||||
Query: "select * from people where first_name % 4 = 0",
|
||||
ExpectedRows: ToSqlRows(PeopleTestSchema, AllPeopleRows...), // invalid value is considered as 0
|
||||
ExpectedSchema: CompressSchema(PeopleTestSchema),
|
||||
},
|
||||
{
|
||||
Name: "select * with where, order by",
|
||||
|
||||
@@ -247,7 +247,6 @@ func SqlColToStr(sqlType sql.Type, col interface{}) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
return res.ToString(), nil
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user