From 42f231394f3be2ea411efd6d31cb26e631724f9a Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Tue, 23 Jul 2024 22:15:21 +0200 Subject: [PATCH] Add additional type to driver and tests Signed-off-by: Dirkjan Bussink --- go/mysql/query_test.go | 3 +++ go/vt/vitessdriver/rows.go | 4 +++- go/vt/vtgate/vindexes/fuzz.go | 1 + go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/go/mysql/query_test.go b/go/mysql/query_test.go index 2915b754582..6892508ac0c 100644 --- a/go/mysql/query_test.go +++ b/go/mysql/query_test.go @@ -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{ { @@ -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, @@ -523,6 +525,7 @@ func TestQueries(t *testing.T) { sqltypes.NULL, sqltypes.NULL, sqltypes.NULL, + sqltypes.NULL, }, }, }) diff --git a/go/vt/vitessdriver/rows.go b/go/vt/vitessdriver/rows.go index 1af88e64ec3..d3c5ca7e4d4 100644 --- a/go/vt/vitessdriver/rows.go +++ b/go/vt/vitessdriver/rows.go @@ -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: @@ -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: diff --git a/go/vt/vtgate/vindexes/fuzz.go b/go/vt/vtgate/vindexes/fuzz.go index f1def0c3e1e..5a54aeb2bd8 100644 --- a/go/vt/vtgate/vindexes/fuzz.go +++ b/go/vt/vtgate/vindexes/fuzz.go @@ -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 diff --git a/go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go b/go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go index 49dabae3973..81f4d3f7975 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go +++ b/go/vt/vttablet/tabletserver/vstreamer/helper_event_test.go @@ -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) }