You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad83cde
Browse filesBrowse the repository at this point in the historyBrowse files
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closesapache#123` indicates that this PR will close issue apache#123.
-->
- Closesapache#22818.
## Rationale for this change
DataFusion kept SQL dialect metadata in several separate places, which
made it easy for enum variants, canonical names, aliases, display names,
docs, and error messages to drift.
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
- Centralize dialect metadata in one macro-driven source.
- Generate the `Dialect` enum, metadata table, canonical names, aliases,
display names, and available-dialect string from that source.
- Replace `Dialect::AVAILABLE` with `Dialect::available()`.
- Add `Dialect::metadata()` for iterating supported dialects.
- Update dialect error messages and generated config docs to use the
centralized metadata.
- Add an upgrade note for the removed public constant.
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
## Are these changes tested?
Yes
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
## Are there any user-facing changes?
Yes. `Dialect::AVAILABLE` is removed and replaced by
`Dialect::available()`.
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
/// Configure the SQL dialect used by DataFusion's parser.
282
+
/// The configuration reference lists the supported values from [`Dialect::available`].
283
283
pub dialect:Dialect,default = Dialect::Generic
284
284
// no need to lowercase because `sqlparser::dialect_from_str`] is case-insensitive
285
285
@@ -323,87 +323,204 @@ config_namespace! {
323
323
}
324
324
}
325
325
326
-
/// This is the SQL dialect used by DataFusion's parser.
327
-
/// This mirrors [sqlparser::dialect::Dialect](https://docs.rs/sqlparser/latest/sqlparser/dialect/trait.Dialect.html)
328
-
/// trait in order to offer an easier API and avoid adding the `sqlparser` dependency
329
-
#[derive(Debug,Default,Clone,Copy,PartialEq,Eq)]
330
-
pubenumDialect{
331
-
#[default]
332
-
Generic,
333
-
MySQL,
334
-
PostgreSQL,
335
-
Hive,
336
-
SQLite,
337
-
Snowflake,
338
-
Redshift,
339
-
MsSQL,
340
-
ClickHouse,
341
-
BigQuery,
342
-
Ansi,
343
-
DuckDB,
344
-
Databricks,
345
-
Spark,
326
+
/// Metadata for a SQL dialect supported by DataFusion configuration.
327
+
#[derive(Debug,Clone,Copy,PartialEq,Eq)]
328
+
#[non_exhaustive]
329
+
pubstructDialectInfo{
330
+
pubdialect:Dialect,
331
+
pubcanonical_name:&'staticstr,
332
+
pubdisplay_name:&'staticstr,
333
+
pubaliases:&'static[&'staticstr],
334
+
}
335
+
336
+
// Keep this key in sync with the `SqlParserOptions::dialect` config path.
/// This is the SQL dialect used by DataFusion's parser.
363
+
/// This mirrors [sqlparser::dialect::Dialect](https://docs.rs/sqlparser/latest/sqlparser/dialect/trait.Dialect.html)
364
+
/// trait in order to offer an easier API and avoid adding the `sqlparser` dependency
0 commit comments