-
Notifications
You must be signed in to change notification settings - Fork 1.7k
refactor: add dialect enum #18043
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
base: main
Are you sure you want to change the base?
refactor: add dialect enum #18043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @dariocurr this is a great first contribution. I left some suggestions, let us know what you think
/// | ||
/// [`SessionContext::sql`]: crate::execution::context::SessionContext::sql | ||
#[cfg(feature = "sql")] | ||
pub fn sql_to_statement( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is technically a breaking API change (now it requires a &Dialect). Maybe can you add a note to the upgrade guide and a doc example of how to use this API to help people upgrade?
This is explained a bit more in https://datafusion.apache.org/contributor-guide/api-health.html#upgrade-guides
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a section in upgrading.md
but I’m not quite sure I understand what I need to do. I saw in the datafusion API health guide that "when making breaking public API changes, please add the api-change label to the PR" 
Should I add it something more?
} | ||
} | ||
|
||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add documentation to this enum that explains:
- What it represents
- How it is related to https://docs.rs/sqlparser/latest/sqlparser/dialect/trait.Dialect.html ?
Specifically it would help to understand if the intent is to mirror the code in sqlparser
(but is replicated to avoid adding a sqlparser dependency)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback, I added documentation
Which issue does this PR close?
Rationale for this change
This PR introduces a new dialect enum to improve type safety and code maintainability when handling different SQL dialects in DataFusion
What changes are included in this PR?
Dialect
enum to represent supported SQL dialectsAre these changes tested?
Yes
Are there any user-facing changes?
Yes, this is an API change: the type of the
dialect
field changed fromString
toDialect