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
When performing an ORDER BY on a subquery, the vtgate planner generates a plan that does not work.
Example
For the following query:
SELECT (SELECT col FROM user LIMIT1) AS a
FROM user
JOIN user_extra
ORDER BY a;
The planner produces a plan containing this snippet:
{
"OperatorType": "UncorrelatedSubquery",
"Variant": "PulloutValue",
"PulloutVars": [
"__sq1"
],
"Inputs": [
{
"InputName": "SubQuery",
"OperatorType": "Limit",
"Count": "1",
"Inputs": [
{
"OperatorType": "Route",
"Variant": "Scatter",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select col from `user` where 1 != 1",
"Query": "select col from `user` limit 1",
"Table": "`user`"
}
]
},
{
"InputName": "Outer",
"OperatorType": "Route",
"Variant": "Scatter",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select :__sq1 as __sq1, weight_string(:__sq1) from `user` where 1 != 1",
"OrderBy": "(0|1) ASC",
"Query": "select :__sq1 as __sq1, weight_string(:__sq1) from `user` order by __sq1 asc",
"Table": "`user`"
}
]
}
Issue
In the query sent to the outer side of the subquery, the plan uses the column name __sq1 instead of the argument :__sq1, which would be the correct plan.
Result
This discrepancy results in a query that fails on MySQL, as no such column (__sq1) can be found.
The text was updated successfully, but these errors were encountered:
Issue Description
Problem
When performing an ORDER BY on a subquery, the vtgate planner generates a plan that does not work.
Example
For the following query:
The planner produces a plan containing this snippet:
Issue
In the query sent to the outer side of the subquery, the plan uses the column name __sq1 instead of the argument :__sq1, which would be the correct plan.
Result
This discrepancy results in a query that fails on MySQL, as no such column (
__sq1
) can be found.The text was updated successfully, but these errors were encountered: