Skip to content

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

@alamb alamb merged commit cd013c7 into apache:main Nov 17, 2024
25 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 17, 2024

🚀

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