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

Merged query still contains parameters #15547

Closed
systay opened this issue Mar 22, 2024 · 2 comments · Fixed by #15551
Closed

Merged query still contains parameters #15547

systay opened this issue Mar 22, 2024 · 2 comments · Fixed by #15551

Comments

@systay
Copy link
Collaborator

systay commented Mar 22, 2024

When a query can be merged into a single route, we need to remove any arguments that were used while the query was split into multiple smaller queries.

For this query, that is not happening:

select 0
from user as u
         join user_extra as s on u.id = s.user_id
         join music as m on m.user_id = u.id and (s.foo or m.bar)

The resulting plan is:

{
  "QueryType": "SELECT",
  "Original": "select 0 from user as u join user_extra as s on u.id = s.user_id join music as m on m.user_id = u.id and (s.foo or m.bar)",
  "Instructions": {
    "OperatorType": "Route",
    "Variant": "Scatter",
    "Keyspace": {
      "Name": "user",
      "Sharded": true
    },
    "FieldQuery": "select 0 from `user` as u, user_extra as s, music as m where 1 != 1",
    "Query": "select 0 from `user` as u, user_extra as s, music as m where u.id = s.user_id and u.id = :m_user_id and (s.foo or :m_bar) and m.user_id = u.id and (s.foo or m.bar)",
    "Table": "`user`, music, user_extra"
  },
  "TablesUsed": [
    "user.music",
    "user.user",
    "user.user_extra"
  ]
}

In the resulting query some predicates still use the arguments: :m_user_id and (s.foo or :m_bar)

This does not fail on release-18.0.

I suspect this is a duplicate of #15420 but keeping it separate for now.

@systay
Copy link
Collaborator Author

systay commented Mar 22, 2024

Issue introduced in #14974

@wiebeytec
Copy link

wiebeytec commented Mar 25, 2024

Will there be a fix release for Vitess 19 with this? Edit: never mind: I see the related bug report indeed is marked as such 👍

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