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

Improved ergonomy for CREATE EXTERNAL TABLE OPTIONS: Don't require quotations for simple namespaced keys like foo.bar #10483

Merged
merged 2 commits into from
May 13, 2024

Conversation

ozankabak
Copy link
Contributor

@ozankabak ozankabak commented May 13, 2024

Which issue does this PR close?

Quick follow-on to #10404.

Rationale for this change

Now that we migrated to a consistent options syntax for external tables, we should focus on user ergonomy. I don't see a reason why we require simple namespaced option keys like foo.bar to have explicit quotes.

What changes are included in this PR?

Tweaked parser logic to allow quoteless namespaced keys for the OPTIONS clause.

Are these changes tested?

Added a new slt test to exercise the new code path.

Are there any user-facing changes?

Increased user ergonomy.

@ozankabak ozankabak requested a review from alamb May 13, 2024 12:13
@github-actions github-actions bot added sql SQL Planner core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels May 13, 2024
Comment on lines 465 to 476
Token::Word(Word { value, .. }) => {
let mut parts = vec![value];
while self.parser.consume_token(&Token::Period) {
let next_token = self.parser.next_token();
if let Token::Word(Word { value, .. }) = next_token.token {
parts.push(value);
} else {
return self.parser.expected("key name", next_token);
}
}
Ok(parts.join("."))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the main change, the rest is clean-up.

@ozankabak
Copy link
Contributor Author

@berkaysynnada PTAL

format.delimiter '|',
has_header false,
compression gzip);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@berkaysynnada
Copy link
Contributor

This PR addresses the last remaining gap, ensuring that UX achieves the desired balance of consistency and flexibility.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @ozankabak

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 @ozankabak and @berkaysynnada and @comphead -- this looks really nice 👍

I think not only is UX better, the code is better as well

@ozankabak
Copy link
Contributor Author

Thank you all for the reviews 🚀

@ozankabak ozankabak merged commit 5b74c2d into apache:main May 13, 2024
23 checks passed
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
…quotations for simple namespaced keys like `foo.bar` (apache#10483)

* Don't require quotations for simple namespaced keys like foo.bar

* Add comments clarifying parse error cases for unquoted namespaced keys
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.

4 participants