You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: go/vt/vtgate/planbuilder/testdata/reference_cases.json
+140Lines changed: 140 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -771,5 +771,145 @@
771
771
"user.user_extra"
772
772
]
773
773
}
774
+
},
775
+
{
776
+
"comment": "update reference table with join on sharded table",
777
+
"query": "update main.source_of_ref as sr join main.rerouted_ref as rr on sr.id = rr.id inner join user.music as m on sr.col = m.col set sr.tt = 5 where m.user_id = 1",
778
+
"plan": {
779
+
"QueryType": "UPDATE",
780
+
"Original": "update main.source_of_ref as sr join main.rerouted_ref as rr on sr.id = rr.id inner join user.music as m on sr.col = m.col set sr.tt = 5 where m.user_id = 1",
781
+
"Instructions": {
782
+
"OperatorType": "DMLWithInput",
783
+
"TargetTabletType": "PRIMARY",
784
+
"Offset": [
785
+
"0:[0]"
786
+
],
787
+
"Inputs": [
788
+
{
789
+
"OperatorType": "Join",
790
+
"Variant": "Join",
791
+
"JoinColumnIndexes": "R:0",
792
+
"JoinVars": {
793
+
"m_col": 0
794
+
},
795
+
"TableName": "music_rerouted_ref, source_of_ref",
796
+
"Inputs": [
797
+
{
798
+
"OperatorType": "Route",
799
+
"Variant": "EqualUnique",
800
+
"Keyspace": {
801
+
"Name": "user",
802
+
"Sharded": true
803
+
},
804
+
"FieldQuery": "select m.col from music as m where 1 != 1",
805
+
"Query": "select m.col from music as m where m.user_id = 1 lock in share mode",
806
+
"Table": "music",
807
+
"Values": [
808
+
"1"
809
+
],
810
+
"Vindex": "user_index"
811
+
},
812
+
{
813
+
"OperatorType": "Route",
814
+
"Variant": "Unsharded",
815
+
"Keyspace": {
816
+
"Name": "main",
817
+
"Sharded": false
818
+
},
819
+
"FieldQuery": "select sr.id from source_of_ref as sr, rerouted_ref as rr where 1 != 1",
820
+
"Query": "select sr.id from source_of_ref as sr, rerouted_ref as rr where sr.col = :m_col and sr.id = rr.id lock in share mode",
821
+
"Table": "rerouted_ref, source_of_ref"
822
+
}
823
+
]
824
+
},
825
+
{
826
+
"OperatorType": "Update",
827
+
"Variant": "Unsharded",
828
+
"Keyspace": {
829
+
"Name": "main",
830
+
"Sharded": false
831
+
},
832
+
"TargetTabletType": "PRIMARY",
833
+
"Query": "update source_of_ref as sr set sr.tt = 5 where sr.id in ::dml_vals",
834
+
"Table": "source_of_ref"
835
+
}
836
+
]
837
+
},
838
+
"TablesUsed": [
839
+
"main.rerouted_ref",
840
+
"main.source_of_ref",
841
+
"user.music"
842
+
]
843
+
}
844
+
},
845
+
{
846
+
"comment": "delete from reference table with join on sharded table",
847
+
"query": "delete sr from main.source_of_ref as sr join main.rerouted_ref as rr on sr.id = rr.id inner join user.music as m on sr.col = m.col where m.user_id = 1",
848
+
"plan": {
849
+
"QueryType": "DELETE",
850
+
"Original": "delete sr from main.source_of_ref as sr join main.rerouted_ref as rr on sr.id = rr.id inner join user.music as m on sr.col = m.col where m.user_id = 1",
851
+
"Instructions": {
852
+
"OperatorType": "DMLWithInput",
853
+
"TargetTabletType": "PRIMARY",
854
+
"Offset": [
855
+
"0:[0]"
856
+
],
857
+
"Inputs": [
858
+
{
859
+
"OperatorType": "Join",
860
+
"Variant": "Join",
861
+
"JoinColumnIndexes": "R:0",
862
+
"JoinVars": {
863
+
"m_col": 0
864
+
},
865
+
"TableName": "music_rerouted_ref, source_of_ref",
866
+
"Inputs": [
867
+
{
868
+
"OperatorType": "Route",
869
+
"Variant": "EqualUnique",
870
+
"Keyspace": {
871
+
"Name": "user",
872
+
"Sharded": true
873
+
},
874
+
"FieldQuery": "select m.col from music as m where 1 != 1",
875
+
"Query": "select m.col from music as m where m.user_id = 1",
876
+
"Table": "music",
877
+
"Values": [
878
+
"1"
879
+
],
880
+
"Vindex": "user_index"
881
+
},
882
+
{
883
+
"OperatorType": "Route",
884
+
"Variant": "Unsharded",
885
+
"Keyspace": {
886
+
"Name": "main",
887
+
"Sharded": false
888
+
},
889
+
"FieldQuery": "select sr.id from source_of_ref as sr, rerouted_ref as rr where 1 != 1",
890
+
"Query": "select sr.id from source_of_ref as sr, rerouted_ref as rr where sr.col = :m_col and sr.id = rr.id",
891
+
"Table": "rerouted_ref, source_of_ref"
892
+
}
893
+
]
894
+
},
895
+
{
896
+
"OperatorType": "Delete",
897
+
"Variant": "Unsharded",
898
+
"Keyspace": {
899
+
"Name": "main",
900
+
"Sharded": false
901
+
},
902
+
"TargetTabletType": "PRIMARY",
903
+
"Query": "delete from source_of_ref as sr where sr.id in ::dml_vals",
0 commit comments