Skip to content
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

Add identifier quote style to Dialect trait #1170

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

backkem
Copy link
Contributor

@backkem backkem commented Mar 10, 2024

This relates to apache/datafusion#9517 where we're adding an SQL unparser to turn DataFusion Expr/Plans back into SQL.

I extended the method to allow passing the identifier value. This may be helpful in case we want to add heuristics to only add quotes if truly needed by the dialect.

@backkem
Copy link
Contributor Author

backkem commented Mar 10, 2024

cc @alamb

@alamb
Copy link
Contributor

alamb commented Mar 11, 2024

Looks good to me -- thank you @backkem

I think before we could merge this PR we need some tests ( mostly so if it got broken by accident in the future we would know because a test would fail)

@coveralls
Copy link

coveralls commented Mar 11, 2024

Pull Request Test Coverage Report for Build 8238316231

Details

  • 12 of 15 (80.0%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.005%) to 87.859%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/dialect/mysql.rs 0 1 0.0%
src/dialect/mod.rs 10 12 83.33%
Files with Coverage Reduction New Missed Lines %
src/dialect/mod.rs 1 80.8%
Totals Coverage Status
Change from base Build 8208430635: -0.005%
Covered Lines: 20501
Relevant Lines: 23334

💛 - Coveralls

@backkem
Copy link
Contributor Author

backkem commented Mar 11, 2024

I added a basic test. It feels somewhat artificial but I didn't want to build additional 'unparser' logic in the test case.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a basic test. It feels somewhat artificial but I didn't want to build additional 'unparser' logic in the test case.

I agree it feels somewhat forced, but I think that is also OK in this case. We can improve things later if necessary.

Thank you @backkem

@alamb alamb changed the title feat: add identifier quote style to dialect Add identifier quote style to dialect Mar 11, 2024
@alamb alamb changed the title Add identifier quote style to dialect Add identifier quote style to Dialect trait Mar 11, 2024
@alamb alamb merged commit 929c646 into apache:main Mar 11, 2024
10 checks passed
@backkem backkem deleted the unparser-dialect branch March 11, 2024 20:53
lustefaniak pushed a commit to getsynq/sqlparser-rs that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants