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

Fix duckdb & sqlite character_length scalar unparsing #13428

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Sevenannn
Copy link
Contributor

Which issue does this PR close?

N/A

Rationale for this change

When unparsing CharacterLengthFunc scalar function to DuckDB & SQLite syntax SQL query, the CharacterLengthFunc scalar function need to be unparsed to length, since length is the equivalence of CharacterLengthFunc in DuckDB & SQLite.

DuckDB length()
SQLite length()

What changes are included in this PR?

  • Add struct DuckDBDialect, which implements the Dialect trait
  • Add new method character_length_style for Dialect trait for determining the CharacterLengthStyle to use for a dialect
  • Add helper function character_length_to_sql, which unparses the CharacterLengthFunc to length or character_length based on CharacterLengthStyle

Are these changes tested?

Yes

Are there any user-facing changes?

No

* Fix duckdb & sqlite character_length scalar unparsing

* Add comments

* Update CharacterLengthStyle::SQLStandard to CharacterLengthExtractStyle::CharacterLength
@github-actions github-actions bot added the sql SQL Planner label Nov 14, 2024
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.

Thanks @Sevenannn -- looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants