Skip to content

Commit

Permalink
Add test cases for insert/update/delete rerouting for reference tables
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
  • Loading branch information
rohit-nayak-ps committed Apr 25, 2024
1 parent 363f90d commit 237cdfc
Showing 1 changed file with 63 additions and 4 deletions.
67 changes: 63 additions & 4 deletions go/vt/vtgate/planbuilder/testdata/onecase.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,68 @@
[
{
"comment": "Add your test case here for debugging and run go test -run=One.",
"query": "",
"comment": "delete from reference table - query send to source table",
"query": "delete from user.ref_with_source where col = 1",
"plan": {

"QueryType": "DELETE",
"Original": "delete from user.ref_with_source where col = 1",
"Instructions": {
"OperatorType": "Delete",
"Variant": "Unsharded",
"Keyspace": {
"Name": "main",
"Sharded": false
},
"TargetTabletType": "PRIMARY",
"Query": "delete from source_of_ref where col = 1",
"Table": "source_of_ref"
},
"TablesUsed": [
"main.source_of_ref"
]
}
},
{
"comment": "update from reference table - query send to source table",
"query": "update user.ref_with_source set x = 4 where col = 1",
"plan": {
"QueryType": "UPDATE",
"Original": "update user.ref_with_source set x = 4 where col = 1",
"Instructions": {
"OperatorType": "Update",
"Variant": "Unsharded",
"Keyspace": {
"Name": "main",
"Sharded": false
},
"TargetTabletType": "PRIMARY",
"Query": "update source_of_ref set x = 4 where col = 1",
"Table": "source_of_ref"
},
"TablesUsed": [
"main.source_of_ref"
]
}
},
{
"comment": "insert from reference table - query send to source table",
"query": "insert into user.ref_with_source(x) values(4)",
"plan": {
"QueryType": "INSERT",
"Original": "insert into user.ref_with_source(x) values(4)",
"Instructions": {
"OperatorType": "Insert",
"Variant": "Unsharded",
"Keyspace": {
"Name": "main",
"Sharded": false
},
"TargetTabletType": "PRIMARY",
"Query": "insert into source_of_ref(x) values (4)",
"TableName": "source_of_ref"
},
"TablesUsed": [
"main.source_of_ref"
]
}
}
]
]

0 comments on commit 237cdfc

Please sign in to comment.