Skip to content

Commit

Permalink
Add additional type to driver and tests
Browse files Browse the repository at this point in the history
Signed-off-by: Dirkjan Bussink <[email protected]>
  • Loading branch information
dbussink committed Jul 24, 2024
1 parent fc81d36 commit 42f2313
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions go/mysql/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ func TestQueries(t *testing.T) {
// Skip TUPLE, not possible in Result.
{Name: "Type_GEOMETRY ", Type: querypb.Type_GEOMETRY, Charset: collations.CollationBinaryID, Flags: uint32(querypb.MySqlFlag_BINARY_FLAG | querypb.MySqlFlag_BLOB_FLAG)},
{Name: "Type_JSON ", Type: querypb.Type_JSON, Charset: collations.CollationUtf8mb4ID},
{Name: "Type_VECTOR ", Type: querypb.Type_VECTOR, Charset: collations.CollationBinaryID},
},
Rows: [][]sqltypes.Value{
{
Expand Down Expand Up @@ -492,6 +493,7 @@ func TestQueries(t *testing.T) {
sqltypes.MakeTrusted(querypb.Type_SET, []byte("Type_SET")),
sqltypes.MakeTrusted(querypb.Type_GEOMETRY, []byte("Type_GEOMETRY")),
sqltypes.MakeTrusted(querypb.Type_JSON, []byte("Type_JSON")),
sqltypes.MakeTrusted(querypb.Type_VECTOR, []byte("Type_VECTOR")),
},
{
sqltypes.NULL,
Expand Down Expand Up @@ -523,6 +525,7 @@ func TestQueries(t *testing.T) {
sqltypes.NULL,
sqltypes.NULL,
sqltypes.NULL,
sqltypes.NULL,
},
},
})
Expand Down
4 changes: 3 additions & 1 deletion go/vt/vitessdriver/rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (ri *rows) ColumnTypeScanType(index int) reflect.Type {
case query.Type_TIMESTAMP, query.Type_DECIMAL, query.Type_VARCHAR, query.Type_TEXT,
query.Type_BLOB, query.Type_VARBINARY, query.Type_CHAR, query.Type_BINARY, query.Type_BIT,
query.Type_ENUM, query.Type_SET, query.Type_TUPLE, query.Type_GEOMETRY, query.Type_JSON,
query.Type_HEXNUM, query.Type_HEXVAL, query.Type_BITNUM:
query.Type_HEXNUM, query.Type_HEXVAL, query.Type_BITNUM, query.Type_VECTOR:

return typeRawBytes
case query.Type_DATE, query.Type_TIME, query.Type_DATETIME:
Expand Down Expand Up @@ -179,6 +179,8 @@ func (ri *rows) ColumnTypeDatabaseTypeName(index int) string {
return "GEOMETRY"
case query.Type_JSON:
return "JSON"
case query.Type_VECTOR:
return "VECTOR"
case query.Type_TIMESTAMP:
return "TIMESTAMP"
case query.Type_DATE:
Expand Down
1 change: 1 addition & 0 deletions go/vt/vtgate/vindexes/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var querypbTypes = []querypb.Type{querypb.Type_NULL_TYPE,
querypb.Type_SET,
querypb.Type_GEOMETRY,
querypb.Type_JSON,
querypb.Type_VECTOR,
querypb.Type_EXPRESSION}

// All valid vindexes
Expand Down
2 changes: 2 additions & 0 deletions go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,8 @@ func getQueryType(strType string) query.Type {
return query.Type_SET
case "JSON":
return query.Type_JSON
case "VECTOR":
return query.Type_VECTOR
default:
panic("unknown type " + strType)
}
Expand Down

0 comments on commit 42f2313

Please sign in to comment.