Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion go/vt/vtgate/engine/vindex_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,23 @@ func (vf *VindexFunc) buildRow(id sqltypes.Value, ksid []byte, kr *topodatapb.Ke
}

func (vf *VindexFunc) description() PrimitiveDescription {
return PrimitiveDescription{OperatorType: "vindexfunc - not implemented"}
fields := map[string]string{}
for _, field := range vf.Fields {
fields[field.Name] = field.Type.String()
}

other := map[string]interface{}{
"Fields": fields,
"Columns": vf.Cols,
"Value": vf.Value,
}
if vf.Vindex != nil {
other["Vindex"] = vf.Vindex.String()
}

return PrimitiveDescription{
OperatorType: "VindexFunc",
Variant: vindexOpcodeName[vf.Opcode],
Other: other,
}
}
17 changes: 16 additions & 1 deletion go/vt/vtgate/planbuilder/testdata/memory_sort_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,22 @@
"OrderBy": "2 ASC",
"Inputs": [
{
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
0,
1,
2,
3
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY",
"range_end": "VARBINARY",
"range_start": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
}
]
}
Expand Down
123 changes: 114 additions & 9 deletions go/vt/vtgate/planbuilder/testdata/vindex_func_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@
"QueryType": "SELECT",
"Original": "select id, keyspace_id, range_start, range_end from user_index where id = :id",
"Instructions": {
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
0,
1,
2,
3
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY",
"range_end": "VARBINARY",
"range_start": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
}
}

Expand All @@ -14,7 +29,22 @@
"QueryType": "SELECT",
"Original": "select * from user_index where id = :id",
"Instructions": {
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
0,
1,
2,
3
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY",
"range_end": "VARBINARY",
"range_start": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
}
}

Expand All @@ -24,7 +54,19 @@
"QueryType": "SELECT",
"Original": "select id, keyspace_id, id from user_index where id = :id",
"Instructions": {
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
0,
1,
0
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
}
}

Expand All @@ -38,7 +80,19 @@
"QueryType": "SELECT",
"Original": "select id, keyspace_id, id from second_user.hash_dup where id = :id",
"Instructions": {
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
0,
1,
0
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "hash_dup"
}
}

Expand All @@ -54,7 +108,16 @@
"TableName": "_unsharded",
"Inputs": [
{
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
1
],
"Fields": {
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
},
{
"OperatorType": "Route",
Expand Down Expand Up @@ -94,7 +157,16 @@
"Table": "unsharded"
},
{
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
1
],
"Fields": {
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
}
]
}
Expand All @@ -112,7 +184,18 @@
"TableName": "_unsharded",
"Inputs": [
{
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
0,
1
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
},
{
"OperatorType": "Route",
Expand Down Expand Up @@ -141,7 +224,18 @@
"TableName": "_unsharded",
"Inputs": [
{
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
1,
0
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
},
{
"OperatorType": "Route",
Expand Down Expand Up @@ -170,7 +264,18 @@
"TableName": "_unsharded",
"Inputs": [
{
"OperatorType": "vindexfunc - not implemented"
"OperatorType": "VindexFunc",
"Variant": "VindexMap",
"Columns": [
1,
0
],
"Fields": {
"id": "VARBINARY",
"keyspace_id": "VARBINARY"
},
"Value": ":id",
"Vindex": "user_index"
},
{
"OperatorType": "Route",
Expand Down