Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: PulloutSubquery has missing bind var __sq_has_values1 #9854

Closed
frouioui opened this issue Mar 9, 2022 · 0 comments · Fixed by #9855
Closed

Bug Report: PulloutSubquery has missing bind var __sq_has_values1 #9854

frouioui opened this issue Mar 9, 2022 · 0 comments · Fixed by #9855

Comments

@frouioui
Copy link
Member

frouioui commented Mar 9, 2022

Overview of the Issue

When executing a sharded query with an EXISTS using the Gen4 planner, VTTablet produces the following error: missing bind var __sq_has_values1. The v3 planner does not fail.

The issue was first seen in #9710 when changing VTGate's default planner. The test TestExplain started failing (See failure in CI) with the selectsharded query:

select name from user where exists (select id from t1) /* non-correlated subquery as EXISTS */;

The plan for the query above is:

{
  "QueryType": "SELECT",
  "Original": "select name from user where exists (select id from t1)",
  "Instructions": {
    "OperatorType": "Subquery",
    "Variant": "PulloutExists",
    "PulloutVars": [
      "__sq_has_values1"
    ],
    "Inputs": [
      {
        "OperatorType": "Route",
        "Variant": "Scatter",
        "Keyspace": {
          "Name": "zlookup_unique",
          "Sharded": true
        },
        "FieldQuery": "select id from t1 where 1 != 1",
        "Query": "select id from t1",
        "Table": "t1"
      },
      {
        "OperatorType": "Route",
        "Variant": "Scatter",
        "Keyspace": {
          "Name": "user",
          "Sharded": true
        },
        "FieldQuery": "select `name` from `user` where 1 != 1",
        "Query": "select `name` from `user` where :__sq_has_values1",
        "Table": "`user`"
      }
    ]
  }
}

The issue is also reproducible with the local examples.

Reproduction Steps

  1. Deploy a sharded Vitess cluster using the examples
  2. Run the following query:
select /*vt+ PLANNER=gen4 */ order_id from corder where exists (select customer_id from customer);
  1. The output should contain the error:
ERROR 1105 (HY000): target: customer.-80.primary: vttablet: rpc error: code = InvalidArgument desc = missing bind var __sq_has_values1 (CallerID: userData1)
target: customer.80-.primary: vttablet: rpc error: code = InvalidArgument desc = missing bind var __sq_has_values1 (CallerID: userData1)

Binary Version

main

Operating System and Environment details

MacOS

Log Fragments

No response

@frouioui frouioui added Type: Bug Needs Triage This issue needs to be correctly labelled and triaged labels Mar 9, 2022
@frouioui frouioui self-assigned this Mar 9, 2022
@frouioui frouioui added Component: Query Serving and removed Needs Triage This issue needs to be correctly labelled and triaged labels Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant