feat: add SQL dialect support with Spark SQL dialect#150
Merged
ChunxuTang merged 6 commits intolance-format:mainfrom Mar 25, 2026
Merged
feat: add SQL dialect support with Spark SQL dialect#150ChunxuTang merged 6 commits intolance-format:mainfrom
ChunxuTang merged 6 commits intolance-format:mainfrom
Conversation
Add SqlDialect enum and SparkDialect implementation using DataFusion's unparser Dialect trait. The to_sql() method now accepts an optional dialect parameter to generate dialect-specific SQL from Cypher queries. Supported dialects: Default, Spark, PostgreSQL, MySQL, SQLite. Spark SQL differences: backtick quoting, STRING type, EXTRACT for date parts, LENGTH instead of CHARACTER_LENGTH, required subquery aliases. Python API updated: to_sql(datasets, dialect="spark") Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ChunxuTang
reviewed
Mar 8, 2026
Collaborator
ChunxuTang
left a comment
There was a problem hiding this comment.
The motivation for adding SQL dialects makes sense to me.
Left some comments on the design of the new feature.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Use CustomDialectBuilder for Spark dialect instead of manual Dialect impl - Move SqlDialect enum from spark_dialect.rs to query.rs as general-purpose type - Expose SqlDialect as a Python enum instead of error-prone string parameter Co-authored-by: Isaac
ChunxuTang
reviewed
Mar 24, 2026
Collaborator
ChunxuTang
left a comment
There was a problem hiding this comment.
@yuchen-pipi
LGTM! Just left a very minor comment.
Meanwhile, could you fix the style lint error?
Move DialectUnparser and SqlDialect::unparser() from spark_dialect.rs to query.rs to co-locate with the SqlDialect enum. Box the Spark CustomDialect variant to fix clippy::large_enum_variant lint. Co-authored-by: Isaac
ChunxuTang
approved these changes
Mar 24, 2026
added 3 commits
March 23, 2026 22:57
…translation Adds a CLI tool that translates Cypher queries into SQL for various dialects (default, spark, postgresql, mysql, sqlite) using a JSON config file that describes the graph schema. Co-authored-by: Isaac
…-to-SQL translation" This reverts commit d450021.
Co-authored-by: Isaac
Contributor
|
@ChunxuTang The workflow passed, do you mind helping merge it since we don't have this button on our end. |
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.
Summary
SqlDialectenum (Default,Spark,PostgreSql,MySql,Sqlite) andSparkDialectimplementation using DataFusion's unparserDialecttraitto_sql()to accept an optionaldialectparameter instead of a separate method per dialectquery.to_sql(datasets, dialect="spark")Spark SQL dialect differences
STRINGtype instead ofVARCHAREXTRACT(field FROM expr)for date partsLENGTH()instead ofCHARACTER_LENGTH()TIMESTAMPwithout timezone infoUsage
Rust:
Python:
Test plan
to_sqltests updated and passing🤖 Generated with Claude Code