diff --git a/go/vt/vtgate/planbuilder/testdata/filter_cases.txt b/go/vt/vtgate/planbuilder/testdata/filter_cases.txt index 219d84bd877..61339d7a816 100644 --- a/go/vt/vtgate/planbuilder/testdata/filter_cases.txt +++ b/go/vt/vtgate/planbuilder/testdata/filter_cases.txt @@ -1760,7 +1760,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select id from `user` where 1 != 1", - "Query": "select id from `user` where :__sq_has_values1 = 1 and id in ::__vals", + "Query": "select id from `user` where (:__sq_has_values1 = 1 and id in ::__vals)", "Table": "`user`", "Values": [ "::__sq1" @@ -1999,7 +1999,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select id2 from `user` where 1 != 1", - "Query": "select id2 from `user` where :__sq_has_values2 = 1 and id2 in ::__sq2", + "Query": "select id2 from `user` where (:__sq_has_values2 = 1 and id2 in ::__sq2)", "Table": "`user`" } ] @@ -2414,7 +2414,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select id from `user` where 1 != 1", - "Query": "select id from `user` where not (:__sq_has_values1 = 1 and id in ::__sq1) and :__sq_has_values2 = 1 and id in ::__vals", + "Query": "select id from `user` where not (:__sq_has_values1 = 1 and id in ::__sq1) and (:__sq_has_values2 = 1 and id in ::__vals)", "Table": "`user`", "Values": [ "::__sq2" @@ -2574,7 +2574,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select id from `user` where 1 != 1", - "Query": "select id from `user` where :__sq_has_values1 = 1 and id in ::__vals", + "Query": "select id from `user` where (:__sq_has_values1 = 1 and id in ::__vals)", "Table": "`user`", "Values": [ "::__sq1" @@ -2828,7 +2828,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select id from `user` where 1 != 1", - "Query": "select id from `user` where id = 5 and not id in (select user_extra.col from user_extra where user_extra.user_id = 5) and :__sq_has_values2 = 1 and id in ::__sq2", + "Query": "select id from `user` where id = 5 and not id in (select user_extra.col from user_extra where user_extra.user_id = 5) and (:__sq_has_values2 = 1 and id in ::__sq2)", "Table": "`user`", "Values": [ 5 @@ -3260,7 +3260,7 @@ Gen4 plan same as above }, "FieldQuery": "select `user`.id, `user`.col, weight_string(`user`.id), weight_string(`user`.col) from `user` where 1 != 1", "OrderBy": "(0|2) ASC, (1|3) ASC", - "Query": "select `user`.id, `user`.col, weight_string(`user`.id), weight_string(`user`.col) from `user` where :__sq_has_values1 = 1 and `user`.col in ::__sq1 order by `user`.id asc, `user`.col asc", + "Query": "select `user`.id, `user`.col, weight_string(`user`.id), weight_string(`user`.col) from `user` where (:__sq_has_values1 = 1 and `user`.col in ::__sq1) order by `user`.id asc, `user`.col asc", "Table": "`user`" } ] diff --git a/go/vt/vtgate/planbuilder/testdata/from_cases.txt b/go/vt/vtgate/planbuilder/testdata/from_cases.txt index 3f540ef02f9..b477e8d0933 100644 --- a/go/vt/vtgate/planbuilder/testdata/from_cases.txt +++ b/go/vt/vtgate/planbuilder/testdata/from_cases.txt @@ -2955,7 +2955,7 @@ Gen4 plan same as above "Sharded": false }, "FieldQuery": "select unsharded_a.col from unsharded_a, unsharded_b where 1 != 1", - "Query": "select unsharded_a.col from unsharded_a, unsharded_b where :__sq_has_values1 = 1 and unsharded_a.col in ::__sq1", + "Query": "select unsharded_a.col from unsharded_a, unsharded_b where (:__sq_has_values1 = 1 and unsharded_a.col in ::__sq1)", "Table": "unsharded_a, unsharded_b" } ] @@ -3058,7 +3058,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select 1 from `user` where 1 != 1", - "Query": "select 1 from `user` where :__sq_has_values1 = 1 and `user`.col in ::__sq1", + "Query": "select 1 from `user` where (:__sq_has_values1 = 1 and `user`.col in ::__sq1)", "Table": "`user`" } ] @@ -3164,7 +3164,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select 1 from `user` where 1 != 1", - "Query": "select 1 from `user` where :__sq_has_values1 = 1 and `user`.col in ::__sq1", + "Query": "select 1 from `user` where (:__sq_has_values1 = 1 and `user`.col in ::__sq1)", "Table": "`user`" } ] @@ -3278,7 +3278,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select 1 from `user` where 1 != 1", - "Query": "select 1 from `user` where :__sq_has_values1 = 1 and `user`.col in ::__sq1", + "Query": "select 1 from `user` where (:__sq_has_values1 = 1 and `user`.col in ::__sq1)", "Table": "`user`" }, { diff --git a/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt b/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt index 150d3bd3b19..a674a78de97 100644 --- a/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt +++ b/go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt @@ -243,7 +243,7 @@ Gen4 error: Column 'col1' in field list is ambiguous "Sharded": true }, "FieldQuery": "select id from `user` where 1 != 1", - "Query": "select id from `user` where :__sq_has_values1 = 1 and id in ::__vals", + "Query": "select id from `user` where (:__sq_has_values1 = 1 and id in ::__vals)", "Table": "`user`", "Values": [ "::__sq1" @@ -604,7 +604,7 @@ Gen4 plan same as above }, "FieldQuery": "select col, weight_string(col) from `user` where 1 != 1", "OrderBy": "(0|1) ASC", - "Query": "select col, weight_string(col) from `user` where :__sq_has_values1 = 1 and col in ::__sq1 order by col asc", + "Query": "select col, weight_string(col) from `user` where (:__sq_has_values1 = 1 and col in ::__sq1) order by col asc", "ResultColumns": 1, "Table": "`user`" } @@ -953,7 +953,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select col from `user` where 1 != 1", - "Query": "select col from `user` where :__sq_has_values1 = 1 and col in ::__sq1 order by null", + "Query": "select col from `user` where (:__sq_has_values1 = 1 and col in ::__sq1) order by null", "Table": "`user`" } ] @@ -1133,7 +1133,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select col from `user` where 1 != 1", - "Query": "select col from `user` where :__sq_has_values1 = 1 and col in ::__sq1 order by rand()", + "Query": "select col from `user` where (:__sq_has_values1 = 1 and col in ::__sq1) order by rand()", "Table": "`user`" } ] @@ -1689,7 +1689,7 @@ Gen4 plan same as above "Sharded": true }, "FieldQuery": "select col from `user` where 1 != 1", - "Query": "select col from `user` where :__sq_has_values1 = 1 and col in ::__sq1 limit :__upper_limit", + "Query": "select col from `user` where (:__sq_has_values1 = 1 and col in ::__sq1) limit :__upper_limit", "Table": "`user`" } ] diff --git a/go/vt/vtgate/planbuilder/testdata/tpch_cases.txt b/go/vt/vtgate/planbuilder/testdata/tpch_cases.txt index 25a7e29c634..2cef6bd4d3c 100644 --- a/go/vt/vtgate/planbuilder/testdata/tpch_cases.txt +++ b/go/vt/vtgate/planbuilder/testdata/tpch_cases.txt @@ -807,7 +807,7 @@ Gen4 error: unsupported: cross-shard correlated subquery }, "FieldQuery": "select o_custkey, o_orderkey, o_orderdate, o_totalprice, weight_string(o_orderkey), weight_string(o_orderdate), weight_string(o_totalprice) from orders where 1 != 1", "OrderBy": "(3|6) DESC, (2|5) ASC", - "Query": "select o_custkey, o_orderkey, o_orderdate, o_totalprice, weight_string(o_orderkey), weight_string(o_orderdate), weight_string(o_totalprice) from orders where :__sq_has_values1 = 1 and o_orderkey in ::__vals order by o_totalprice desc, o_orderdate asc", + "Query": "select o_custkey, o_orderkey, o_orderdate, o_totalprice, weight_string(o_orderkey), weight_string(o_orderdate), weight_string(o_totalprice) from orders where (:__sq_has_values1 = 1 and o_orderkey in ::__vals) order by o_totalprice desc, o_orderdate asc", "Table": "orders", "Values": [ "::__sq1" diff --git a/go/vt/vtgate/planbuilder/testdata/wireup_cases.txt b/go/vt/vtgate/planbuilder/testdata/wireup_cases.txt index 708c1cb4ade..b9cc301eb71 100644 --- a/go/vt/vtgate/planbuilder/testdata/wireup_cases.txt +++ b/go/vt/vtgate/planbuilder/testdata/wireup_cases.txt @@ -1185,7 +1185,7 @@ "Sharded": true }, "FieldQuery": "select 1 from `user` where 1 != 1", - "Query": "select 1 from `user` where :__sq_has_values1 = 1 and id in ::__vals", + "Query": "select 1 from `user` where (:__sq_has_values1 = 1 and id in ::__vals)", "Table": "`user`", "Values": [ "::__sq1"