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

Incorrect Gen4 Plan #8552

Closed
GuptaManan100 opened this issue Jul 27, 2021 · 0 comments · Fixed by #8557
Closed

Incorrect Gen4 Plan #8552

GuptaManan100 opened this issue Jul 27, 2021 · 0 comments · Fixed by #8557

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

Found an error in the rails tests now, coming from Gen4
Executed query :-

SELECT `assemblies`.* FROM `assemblies` INNER JOIN `assemblies_parts` ON `assemblies`.`id` = `assemblies_parts`.`assembly_id` WHERE `assemblies_parts`.`part_id` = 2

Error -

Code: INVALID_ARGUMENT missing bind var assemblies_parts_assembly_id

Outputs for v3 and Gen4 on the query -

"SELECT `user`.`id` FROM `user` INNER JOIN `user_extra` ON `user`.`id` = `user_extra`.`assembly_id` WHERE `user_extra`.`user_id` = 2"
{
  "QueryType": "SELECT",
  "Original": "SELECT `user`.`id` FROM `user` INNER JOIN `user_extra` ON `user`.`id` = `user_extra`.`assembly_id` WHERE `user_extra`.`user_id` = 2",
  "Instructions": {
    "OperatorType": "Join",
    "Variant": "Join",
    "JoinColumnIndexes": "-1",
    "TableName": "`user`_user_extra",
    "Inputs": [
      {
        "OperatorType": "Route",
        "Variant": "SelectScatter",
        "Keyspace": {
          "Name": "user",
          "Sharded": true
        },
        "FieldQuery": "select `user`.id from `user` where 1 != 1",
        "Query": "select `user`.id from `user`",
        "Table": "`user`"
      },
      {
        "OperatorType": "Route",
        "Variant": "SelectEqualUnique",
        "Keyspace": {
          "Name": "user",
          "Sharded": true
        },
        "FieldQuery": "select 1 from user_extra where 1 != 1",
        "Query": "select 1 from user_extra where user_extra.assembly_id = :user_id and user_extra.user_id = 2",
        "Table": "user_extra",
        "Values": [
          2
        ],
        "Vindex": "user_index"
      }
    ]
  }
}
{
  "QueryType": "SELECT",
  "Original": "SELECT `user`.`id` FROM `user` INNER JOIN `user_extra` ON `user`.`id` = `user_extra`.`assembly_id` WHERE `user_extra`.`user_id` = 2",
  "Instructions": {
    "OperatorType": "Join",
    "Variant": "Join",
    "JoinColumnIndexes": "1",
    "TableName": "user_extra_`user`",
    "Inputs": [
      {
        "OperatorType": "Route",
        "Variant": "SelectEqualUnique",
        "Keyspace": {
          "Name": "user",
          "Sharded": true
        },
        "FieldQuery": "select user_extra.assembly_id from user_extra where 1 != 1",
        "Query": "select user_extra.assembly_id from user_extra where user_extra.user_id = 2",
        "Table": "user_extra",
        "Values": [
          2
        ],
        "Vindex": "user_index"
      },
      {
        "OperatorType": "Route",
        "Variant": "SelectEqualUnique",
        "Keyspace": {
          "Name": "user",
          "Sharded": true
        },
        "FieldQuery": "select `user`.id from `user` where 1 != 1",
        "Query": "select `user`.id from `user` where `user`.id = :user_extra_assembly_id",
        "Table": "`user`",
        "Values": [
          ":user_extra_assembly_id"
        ],
        "Vindex": "user_index"
      }
    ]
  }
}

Binary version

main

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.

2 participants