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

Query planner does not route routed queries to the proper keyspace #15236

Closed
frouioui opened this issue Feb 14, 2024 · 1 comment
Closed

Query planner does not route routed queries to the proper keyspace #15236

frouioui opened this issue Feb 14, 2024 · 1 comment

Comments

@frouioui
Copy link
Member

Overview of the Issue

When using routed queries, the planner does not route them to the proper keyspace.

Reproduction Steps

Use the following onecase.json:

[
  {
    "comment": "Add your test case here for debugging and run go test -run=One.",
    "query": "select * from main.route2 where id > 2",
    "plan": {

    }
  }
]

Modify the routing rules (schema.json) to have:

...
      {
        "from_table": "route2",
        "to_tables": [
          "user.unsharded"
        ]
      },
...

Run TestOne. The plan output we get is:

{
  "Instructions": {
    "FieldQuery": "select * from route2 where 1 != 1",
    "Keyspace": {
      "Name": "main",
      "Sharded": false
    },
    "OperatorType": "Route",
    "Query": "select * from route2 where id > 2",
    "Table": "route2",
    "Variant": "Unsharded"
  },
  "Original": "select * from main.route2 where id > 2",
  "QueryType": "SELECT"
}

Which incorrectly routes the routed query to keyspace main instead of user.

Binary Version

17, 18, 19, main

Operating System and Environment details

n/a

Log Fragments

No response

@frouioui frouioui added Type: Bug Needs Triage This issue needs to be correctly labelled and triaged Component: Query Serving and removed Needs Triage This issue needs to be correctly labelled and triaged labels Feb 14, 2024
@frouioui frouioui self-assigned this Feb 14, 2024
@frouioui frouioui mentioned this issue Feb 14, 2024
5 tasks
@harshit-gangal
Copy link
Member

harshit-gangal commented Feb 15, 2024

This is not an issue. The query is wrong here as route2 does not belong to main keyspace as per the vschema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants