Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The unparser renders
named_structas a DuckDB-style dictionary literal ({"a": 1}) for every dialect (named_struct_to_sqlinunparser/expr.rs), but the postgres, MySQL, SQLite and BigQuery parsers reject that syntax, so unparsed SQL containingnamed_structfails to re-parse under the same dialect it was unparsed for.Adds
Dialect::supports_dictionary_syntax()(default true, matching the dialects whose parsers accept the literal) and falls back to a plainnamed_struct(...)function call otherwise, which survives the round trip. The check sits insidenamed_struct_to_sqlso theget_fieldcompound-access path atexpr.rs:796, which bypasses dialect overrides, is covered too.Includes a parse -> plan -> unparse -> re-parse test; the full
sql_integrationsuite (573) and lib unparser tests (37) pass, and default-dialect output is unchanged.Upstream PR to apache/datafusion to follow; this carries the fix until it lands there.