-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed output starrocks varchar(255) tansfer error bug
- Loading branch information
jc3wish
committed
Feb 25, 2024
1 parent
5d76896
commit 064c5bd
Showing
3 changed files
with
193 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
package src | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/smartystreets/goconvey/convey" | ||
) | ||
|
||
func TestTransferToTypeByColumnType_Starrocks(t *testing.T) { | ||
type ColumnTypeStruct struct { | ||
columnTypeList []string | ||
nullable bool | ||
destColumnType string | ||
} | ||
var caseList = []ColumnTypeStruct{ | ||
{ | ||
columnTypeList: []string{"uint64"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(20)", | ||
}, | ||
{ | ||
columnTypeList: []string{"int64", "uint32"}, | ||
nullable: false, | ||
destColumnType: "BIGINT(20)", | ||
}, | ||
{ | ||
columnTypeList: []string{"int32", "uint24", "int24", "uint16"}, | ||
nullable: false, | ||
destColumnType: "INT(11)", | ||
}, | ||
{ | ||
columnTypeList: []string{"int16", "year(4)", "year(2)", "year", "uint8"}, | ||
nullable: false, | ||
destColumnType: "SMALLINT(6)", | ||
}, | ||
{ | ||
columnTypeList: []string{"int8", "bool"}, | ||
nullable: false, | ||
destColumnType: "TINYINT(4)", | ||
}, | ||
{ | ||
columnTypeList: []string{"float"}, | ||
nullable: false, | ||
destColumnType: "FLOAT", | ||
}, | ||
{ | ||
columnTypeList: []string{"double", "real"}, | ||
nullable: false, | ||
destColumnType: "DOUBLE", | ||
}, | ||
{ | ||
columnTypeList: []string{"decimal", "numeric"}, | ||
nullable: false, | ||
destColumnType: "DECIMAL", | ||
}, | ||
{ | ||
columnTypeList: []string{"decimal(9,2)"}, | ||
nullable: false, | ||
destColumnType: "Decimal(9,2)", | ||
}, | ||
{ | ||
columnTypeList: []string{"decimal(19,5)"}, | ||
nullable: false, | ||
destColumnType: "Decimal(19,5)", | ||
}, | ||
{ | ||
columnTypeList: []string{"decimal(38,2)"}, | ||
nullable: false, | ||
destColumnType: "Decimal(38,2)", | ||
}, | ||
{ | ||
columnTypeList: []string{"decimal(39,2)"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(78)", | ||
}, | ||
{ | ||
columnTypeList: []string{"decimal(88,2)"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(255)", | ||
}, | ||
{ | ||
columnTypeList: []string{"date", "Nullable(date)"}, | ||
nullable: false, | ||
destColumnType: "DATE", | ||
}, | ||
{ | ||
columnTypeList: []string{"json"}, | ||
nullable: false, | ||
destColumnType: "JSON", | ||
}, | ||
{ | ||
columnTypeList: []string{"time"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(10)", | ||
}, | ||
{ | ||
columnTypeList: []string{"enum"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(255)", | ||
}, | ||
{ | ||
columnTypeList: []string{"set"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(2048)", | ||
}, | ||
{ | ||
columnTypeList: []string{"string", "longblob", "longtext"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(163841)", | ||
}, | ||
{ | ||
columnTypeList: []string{"double(9,2)", "real(10,2)"}, | ||
nullable: false, | ||
destColumnType: "DOUBLE", | ||
}, | ||
{ | ||
columnTypeList: []string{"float(9,2)"}, | ||
nullable: false, | ||
destColumnType: "FLOAT", | ||
}, | ||
{ | ||
columnTypeList: []string{"bit"}, | ||
nullable: false, | ||
destColumnType: "BIGINT(20)", | ||
}, | ||
{ | ||
columnTypeList: []string{"timestamp(6)", "datetime(3)"}, | ||
nullable: false, | ||
destColumnType: "DATETIME", | ||
}, | ||
{ | ||
columnTypeList: []string{"time(6)", "time(1)"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(16)", | ||
}, | ||
{ | ||
columnTypeList: []string{"enum('a','b')"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(255)", | ||
}, | ||
{ | ||
columnTypeList: []string{"set('a','b')"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(2048)", | ||
}, | ||
{ | ||
columnTypeList: []string{"char(1)"}, | ||
nullable: false, | ||
destColumnType: "CHAR(1)", | ||
}, | ||
{ | ||
columnTypeList: []string{"char(255)"}, | ||
nullable: false, | ||
destColumnType: "CHAR(255)", | ||
}, | ||
{ | ||
columnTypeList: []string{"varchar(500)"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(500)", | ||
}, | ||
|
||
{ | ||
columnTypeList: []string{"Nullable(varchar(500))"}, | ||
nullable: false, | ||
destColumnType: "VARCHAR(500)", | ||
}, | ||
{ | ||
columnTypeList: []string{"Nullable(int64)"}, | ||
nullable: true, | ||
destColumnType: "BIGINT(20) DEFAULT NULL", | ||
}, | ||
} | ||
|
||
c := &Conn{} | ||
for _, caseInfo := range caseList { | ||
for _, columnType := range caseInfo.columnTypeList { | ||
Convey(caseInfo.destColumnType, t, func() { | ||
toDestColumnType := c.TransferToTypeByColumnType_Starrocks(columnType, caseInfo.nullable) | ||
So(toDestColumnType, ShouldEqual, caseInfo.destColumnType) | ||
}) | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package src | ||
|
||
const VERSION = "v2.2.0" | ||
const BIFROST_VERION = "v2.2.0" | ||
const VERSION = "v2.3.5" | ||
const BIFROST_VERION = "v2.3.4" |