Allow expr_to_sql unparsing with no quotes #10198
Merged
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.
Which issue does this PR close?
Closes #10197
Rationale for this change
I'm using the Unparser.expr_to_sql function to translate a DataFusion Expr into an expression for Spark Connect. Unlike most SQL engines, Spark doesn't like quoting the column identifiers. I want to be able to generate an expression like
a > 4
but currently I can only get"a" > 4
I believe this might be useful beyond Spark for other database systems that can handle unquoted column identifiers.
What changes are included in this PR?
Changes the DefaultDialect for the Unparser to return
Some('"')
foridentifier_quote_style
, and then changes the usage ofidentifier_quote_style
to not unwrap to"
if it is None, but pass the Option through.Are these changes tested?
Yes
Are there any user-facing changes?
No, this change is backwards-compatible.