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

Allow semi-colon at the end of UNCACHE statement #1320

Merged
merged 2 commits into from
Jun 23, 2024

Conversation

LorrensP-2158466
Copy link
Contributor

Closes #1244.

The function that parses UNCACHE statements now also accepts a semi-colon as the end of the statement.

Had to modify one test because the error message expected ... now also contains the semi-colon.

} else {
self.expected("an `EOF`", self.peek_token())
}),
token_loc => self.expected("`EOF` or `;`", token_loc),
}
} else {
self.expected("a `TABLE` keyword", self.peek_token())
Copy link
Contributor

Choose a reason for hiding this comment

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

(not necessarily related to this PR) looks like we can avoid the has_table condition altogether by using self.expect_keyword instead of self.parse_keyword to parse the TABLE keyword? if so could we make that change to simplify the function in the same go (assuming its a straightforward change)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh nice catch! I can fix this in this PR if this is straightforward, otherwise I can open up a new issue.

Comment on lines 3618 to 3621
match self.peek_token() {
TokenWithLocation {
token: Token::EOF | Token::SemiColon,
..
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm I'm wondering if we don't do an explicitly check for a terminal token after all? looking at the other stmt parse functions seem that's how they handle it, by only parsing the components they need and exiting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's true, but for some reason this parse function only accepts EOF as and of statement. I'll see if we can remove this check.

@LorrensP-2158466
Copy link
Contributor Author

LorrensP-2158466 commented Jun 21, 2024

I did what you suggested and it worked.
The self.expect_keyword works: I just had to change the string in the tests.
And letting the self.parse_statements function handle end of statement instead of this function also works, i just had to change the error strings in the tests.

The function also looks much nicer know.

Thanks for the help!

@alamb
Copy link
Contributor

alamb commented Jun 21, 2024

Looks like this PR now has a conflict

@coveralls
Copy link

coveralls commented Jun 21, 2024

Pull Request Test Coverage Report for Build 9611551238

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 88.989%

Totals Coverage Status
Change from base Build 9565999089: -0.002%
Covered Lines: 26184
Relevant Lines: 29424

💛 - Coveralls

@LorrensP-2158466 LorrensP-2158466 force-pushed the allow-semi-in-uncache-stmnt branch from 8303f1c to f16c1af Compare June 22, 2024 15:36
@LorrensP-2158466
Copy link
Contributor Author

I did a dumb thing, it's fixed now i think.

@coveralls
Copy link

coveralls commented Jun 22, 2024

Pull Request Test Coverage Report for Build 9626589588

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 88.989%

Totals Coverage Status
Change from base Build 9620505751: -0.002%
Covered Lines: 26184
Relevant Lines: 29424

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 22, 2024

Pull Request Test Coverage Report for Build 9626589594

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 88.989%

Totals Coverage Status
Change from base Build 9620505751: -0.002%
Covered Lines: 26184
Relevant Lines: 29424

💛 - Coveralls

Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGMT! cc @alamb

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @LorrensP-2158466 -- it is great to see a bug fixed by simplifying the code

Thank you @iffyio for nthe review

self.expected("a `TABLE` keyword", self.peek_token())
}
self.expect_keyword(Keyword::TABLE)?;
let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@alamb alamb merged commit 7a9793b into apache:main Jun 23, 2024
20 checks passed
@LorrensP-2158466 LorrensP-2158466 deleted the allow-semi-in-uncache-stmnt branch June 23, 2024 15:10
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.

UNCACHE fails to parse with a semicolon
4 participants