You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "dariocurr (via GitHub)" <gi...@apache.org> on 2025/10/13 13:25:44 UTC

[PR] refactor: add dialect enum [datafusion]

dariocurr opened a new pull request, #18043:
URL: https://github.com/apache/datafusion/pull/18043

   ## Which issue does this PR close?
   
   - Closes #18042 
   
   ## 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
   
   1. Provide compile-time guarantees for dialect handling
   2. Improve code readability and self-documentation
   3. Enable better IDE support and autocomplete
   
   ## What changes are included in this PR?
   
   - Added a new `Dialect` enum to represent supported SQL dialects
   - Refactored existing code to use the new enum instead of previous representations
   - Modified tests to work with the new enum-based approach
   
   ## Are these changes tested?
   
   Yes
   
   ## Are there any user-facing changes?
   
   Yes, the type of the `dialect` field changed from `String` to `Dialect`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on code in PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#discussion_r2432299275


##########
datafusion/common/src/config.rs:
##########
@@ -292,6 +292,88 @@ config_namespace! {
     }
 }
 
+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

Review Comment:
   Thank you for your feedback, I added a comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #18043:
URL: https://github.com/apache/datafusion/pull/18043


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#issuecomment-3409648529

   I rebased the branch


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on code in PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#discussion_r2432299275


##########
datafusion/common/src/config.rs:
##########
@@ -292,6 +292,88 @@ config_namespace! {
     }
 }
 
+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

Review Comment:
   Thank you for your feedback, I added documentation



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#issuecomment-3414353438

   Thank you, it's an honor to be part of this fantastic project


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#discussion_r2430426425


##########
datafusion/common/src/config.rs:
##########
@@ -292,6 +292,88 @@ config_namespace! {
     }
 }
 
+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

Review Comment:
   Can you please add documentation to this enum that explains:
   1. What it represents
   2. 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)



##########
datafusion/core/src/execution/session_state.rs:
##########
@@ -374,7 +373,7 @@ impl SessionState {
     pub fn sql_to_statement(

Review Comment:
   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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on code in PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#discussion_r2432299275


##########
datafusion/common/src/config.rs:
##########
@@ -292,6 +292,88 @@ config_namespace! {
     }
 }
 
+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

Review Comment:
   Thank you for your time, I added a comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#issuecomment-3414354447

   > Thank you @dariocurr
   
   
   Thank you, it's an honor to be part of this fantastic project!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "dariocurr (via GitHub)" <gi...@apache.org>.
dariocurr commented on code in PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#discussion_r2432608414


##########
datafusion/core/src/execution/session_state.rs:
##########
@@ -374,7 +373,7 @@ impl SessionState {
     pub fn sql_to_statement(

Review Comment:
   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?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] refactor: add dialect enum [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #18043:
URL: https://github.com/apache/datafusion/pull/18043#issuecomment-3416641930

   We are all just trying to keep it going!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org