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

Improve error message for CREATE EXTERNAL TABLE #6291

Merged
merged 2 commits into from
May 10, 2023

Conversation

parkma99
Copy link
Contributor

@parkma99 parkma99 commented May 9, 2023

Which issue does this PR close?

Closes #6288

Rationale for this change

What changes are included in this PR?

  • Modify create external table parser
  • Add some tests

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels May 9, 2023
@parkma99 parkma99 marked this pull request as ready for review May 9, 2023 06:11
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.

Thanks @parkma99 -- you are a 🦾 recently

} else if self.parser.parse_keywords(&[Keyword::WITH, Keyword::ORDER]) {
ensure_not_set(&builder.order_exprs, "WITH ORDER")?;
builder.order_exprs = Some(self.parse_order_by_exprs()?);
} else if self.parser.parse_keyword(Keyword::WITH) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about using @tz70s 's suggestion at #6257 (comment)

https://docs.rs/sqlparser/0.33.0/sqlparser/parser/struct.Parser.html#method.expect_one_of_keywords

Here is an example of how it could be used: https://github.com/sqlparser-rs/sqlparser-rs/blob/b29b551fa111bbd50c40568f6aea6c49eafc0b9c/src/parser.rs#L6559-L6562

That would also produce an error message that told the user what keywords were expected and what was actually received

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will use it, Thanks

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.

I spent some time playing around with this and I agree it is nicer this way -- thank you @parkma99

@alamb alamb merged commit 6cdfbc6 into apache:main May 10, 2023
@parkma99 parkma99 deleted the error_message_typos branch May 10, 2023 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error message for CREATE EXTERNAL TABLE typos
2 participants