876
876
]
877
877
}
878
878
},
879
+ {
880
+ "comment" : " Comments with subquery" ,
881
+ "query" : " select /* comment */ user.col from user where id IN (select id from user where id > 1 and id < 10)" ,
882
+ "plan" : {
883
+ "Type" : " Scatter" ,
884
+ "QueryType" : " SELECT" ,
885
+ "Original" : " select /* comment */ user.col from user where id IN (select id from user where id > 1 and id < 10)" ,
886
+ "Instructions" : {
887
+ "OperatorType" : " Route" ,
888
+ "Variant" : " Scatter" ,
889
+ "Keyspace" : {
890
+ "Name" : " user" ,
891
+ "Sharded" : true
892
+ },
893
+ "FieldQuery" : " select `user`.col from `user` where 1 != 1" ,
894
+ "Query" : " select /* comment */ `user`.col from `user` where id in (select id from `user` where id > 1 and id < 10)"
895
+ },
896
+ "TablesUsed" : [
897
+ " user.user"
898
+ ]
899
+ }
900
+ },
901
+ {
902
+ "comment" : " Comments with subquery not merged into a single route" ,
903
+ "query" : " select /* comment */ user.col from user where foo IN (select id from user where id > 1 and id < 10)" ,
904
+ "plan" : {
905
+ "Type" : " Complex" ,
906
+ "QueryType" : " SELECT" ,
907
+ "Original" : " select /* comment */ user.col from user where foo IN (select id from user where id > 1 and id < 10)" ,
908
+ "Instructions" : {
909
+ "OperatorType" : " UncorrelatedSubquery" ,
910
+ "Variant" : " PulloutIn" ,
911
+ "PulloutVars" : [
912
+ " __sq_has_values" ,
913
+ " __sq1"
914
+ ],
915
+ "Inputs" : [
916
+ {
917
+ "InputName" : " SubQuery" ,
918
+ "OperatorType" : " Route" ,
919
+ "Variant" : " Scatter" ,
920
+ "Keyspace" : {
921
+ "Name" : " user" ,
922
+ "Sharded" : true
923
+ },
924
+ "FieldQuery" : " select id from `user` where 1 != 1" ,
925
+ "Query" : " select /* comment */ id from `user` where id > 1 and id < 10"
926
+ },
927
+ {
928
+ "InputName" : " Outer" ,
929
+ "OperatorType" : " Route" ,
930
+ "Variant" : " Scatter" ,
931
+ "Keyspace" : {
932
+ "Name" : " user" ,
933
+ "Sharded" : true
934
+ },
935
+ "FieldQuery" : " select `user`.col from `user` where 1 != 1" ,
936
+ "Query" : " select /* comment */ `user`.col from `user` where :__sq_has_values and foo in ::__sq1"
937
+ }
938
+ ]
939
+ },
940
+ "TablesUsed" : [
941
+ " user.user"
942
+ ]
943
+ }
944
+ },
879
945
{
880
946
"comment" : " for update" ,
881
947
"query" : " select user.col from user join user_extra for update" ,
5164
5230
]
5165
5231
}
5166
5232
}
5167
- ]
5233
+ ]
0 commit comments