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

Make SQL parser more BQ compatible #43

Closed
wants to merge 2 commits into from

Conversation

barrkel
Copy link

@barrkel barrkel commented Feb 8, 2024

PR created for code review purposes, not for merging purposes.

@barrkel barrkel requested review from wnob and tanclary February 8, 2024 08:56
Copy link
Collaborator

@tanclary tanclary left a comment

Choose a reason for hiding this comment

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

parser changes look good minus 2 comments, test looks good. I would say if you decide to get this upstreamed that the test could have a comment linking the JIRA, and the commit message could be a bit more descriptive (making it more compatible how?). otherwise looks great!

core/src/main/codegen/templates/Parser.jj Outdated Show resolved Hide resolved
<RPAREN>
{
final SqlParserPos pos = s.end(this);
tableRef = createCall(tableName, pos,
Copy link
Collaborator

Choose a reason for hiding this comment

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

here you initialize tableRef by creating a call, and then the next line you reassign its value by wrapping it in another call, i was curious why you did that. to keep the code simple by breaking across two lines? should it be two separate variables?

Copy link
Author

Choose a reason for hiding this comment

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

I was following the convention of all the other code in the grammar, and the code in this production in particular.

It's really common to have this accumulator pattern:

    sqlNode = ParseSomething()
    sqlNode = ParseSomethingElse(sqlNode)
    sqlNode = ParseAThirdThing(sqlNode)

So I followed the same pattern in the construction of the SqlNode tree here.

But I don't care strongly about it.

@barrkel barrkel closed this Mar 21, 2024
@barrkel barrkel deleted the bk-make-parser-more-bq branch March 21, 2024 12:15
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.

2 participants