Skip to content

Commit

Permalink
Updated plan tests with the new ExtractedSubquery precedence logic
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui committed Oct 12, 2021
1 parent f31d4c3 commit e12a286
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions go/vt/vtgate/planbuilder/testdata/filter_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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`"
}
]
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`"
}
]
Expand Down
8 changes: 4 additions & 4 deletions go/vt/vtgate/planbuilder/testdata/from_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
Expand Down Expand Up @@ -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`"
}
]
Expand Down Expand Up @@ -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`"
}
]
Expand Down Expand Up @@ -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`"
},
{
Expand Down
10 changes: 5 additions & 5 deletions go/vt/vtgate/planbuilder/testdata/postprocess_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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`"
}
Expand Down Expand Up @@ -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`"
}
]
Expand Down Expand Up @@ -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`"
}
]
Expand Down Expand Up @@ -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`"
}
]
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/testdata/tpch_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/testdata/wireup_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e12a286

Please sign in to comment.