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

AST struct name rewording #6642

Merged
merged 7 commits into from
Sep 1, 2020
Merged

Conversation

systay
Copy link
Collaborator

@systay systay commented Aug 28, 2020

I've always found two things confusing with the Vitess AST - one is that the same struct is used for literals and for parameterised query arguments, and the other is that literal expressions are represented by a SQLVal struct.

I think which words we use makes a big difference for how understandable something is, so this PR tries to improve on the word choices around arguments and literals.

Literal expressions are expressions that always evaluate to a fixed value.

SQLVal makes you think that it's a value, and a value is a runtime thing, not something that exists in source code. In source code (even SQL), we usually represent these values with literals.

I know that there is a historic reason why arguments and literals were represented using the same struct, but this issue has been resolved, so there was no good reason to keep them as one.

Signed-off-by: Andres Taylor <andres@planetscale.com>
…e SQLVal struct

Signed-off-by: Andres Taylor <andres@planetscale.com>
To support parameterised queries, Vitess has a argumnet expression. This commit changes the AST used to represent these expressions. Before, the same struct was used for literal values and arguments; this change introduces a new struct used only for arguments.

Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay requested a review from sougou as a code owner August 28, 2020 15:34
Copy link
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

I like

Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@harshit-gangal harshit-gangal merged commit c8b47c8 into vitessio:master Sep 1, 2020
@harshit-gangal harshit-gangal deleted the ast-names branch September 1, 2020 12:32
@askdba askdba added this to the v8.0 milestone Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants