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

[Gen4] Implemented table alias functionality in the semantic analysis #7629

Merged
merged 10 commits into from
Apr 27, 2021

Conversation

systay
Copy link
Collaborator

@systay systay commented Mar 7, 2021

Description

This PR teaches the semantic analysis how to deal with table aliases.
Every table mentioned in the FROM will now either be explicitly qualified with the database name, or the current database is used to qualify the table.
This PR also adds support for routed tables, which depend on table aliases being available.

Checklist

  • Should this PR be backported? Nope
  • Tests were added or are not required Lots of tests added
  • Documentation was added or is not required Not required

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving

Signed-off-by: Florent Poinsard <[email protected]>
@systay systay marked this pull request as ready for review April 15, 2021 13:59
Signed-off-by: Andres Taylor <[email protected]>
Comment on lines +49 to +52
keyspace, err := vschema.DefaultKeyspace()
if err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will start failing for cases when there is no default database selected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm... how come no tests are failing? do we need to add more tests to the planner?

you are probably absolutely correct about this comment. that being said - since this is not failing any tests, how about we take care of this in a separate PR? We should add more tests, and then also fix the issue

WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are introducing this check here, so it be be better to have a test that covers the error case if existing tests do not fail.

go/vt/vtgate/semantics/analyzer.go Outdated Show resolved Hide resolved
@harshit-gangal
Copy link
Member

CI tests are failing.

Signed-off-by: Andres Taylor <[email protected]>
@systay systay added Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature) labels Apr 26, 2021
@systay systay merged commit 7e13d4b into vitessio:master Apr 27, 2021
@systay systay deleted the gen4-table-aliases branch April 27, 2021 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants