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

Add parsing for common table expressions using WITH clause #8918

Merged
merged 8 commits into from
Oct 18, 2021

Conversation

ritwizsinha
Copy link
Contributor

@ritwizsinha ritwizsinha commented Oct 3, 2021

Description

Updated grammar and formatting to add support for common table expressions

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Signed-off-by: ritwizsinha <ritwizsinha0@gmail.com>
Signed-off-by: ritwizsinha <ritwizsinha0@gmail.com>
Signed-off-by: ritwizsinha <ritwizsinha0@gmail.com>
@ritwizsinha ritwizsinha added Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature) labels Oct 6, 2021
Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

We should also fail gracefully in the planners when we encounter a with ast node

Signed-off-by: ritwizsinha <ritwizsinha0@gmail.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
@GuptaManan100 GuptaManan100 self-requested a review October 13, 2021 09:55
Copy link
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

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

Looks good to me, left a couple of comments :)

go/vt/sqlparser/sql.y Outdated Show resolved Hide resolved
Signed-off-by: ritwizsinha <ritwizsinha0@gmail.com>
@GuptaManan100 GuptaManan100 merged commit 24e5cdf into vitessio:main Oct 18, 2021
Copy link
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

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

overall looks good. Just 1 comment.

Comment on lines +36 to +45
switch node := selStatement.(type) {
case *sqlparser.Select:
if node.With != nil {
return nil, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: with expression in select statement")
}
case *sqlparser.Union:
if node.With != nil {
return nil, vterrors.New(vtrpcpb.Code_UNIMPLEMENTED, "unsupported: with expression in union statement")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: add the function on the SelectStatement interface.

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.

5 participants