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

feat: Add DateFieldExtractStyle::Strftime support for SqliteDialect unparser #12161

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

peasee
Copy link
Contributor

@peasee peasee commented Aug 26, 2024

Which issue does this PR close?

Closes #12160

Rationale for this change

  • In SQLite, the only way to extract date information is through strftime. The unparser needs to be updated to support strftime, as any other scalar function results in SQLite query errors.

What changes are included in this PR?

  • Changes the default DateFieldExtractStyle for SQLite to Strftime
  • Implements the unparser for DateFieldExtractStyle::Strftime to use strftime instead of date_part

Are these changes tested?

Yes

Are there any user-facing changes?

No?

…pache#26)

* feat: Add DateFieldExtractStyle::Strftime support for SqliteDialect

* refactor: Refactor DateFieldExtractStyle if checks into if/match
Copy link
Contributor

@devinjdangelo devinjdangelo left a comment

Choose a reason for hiding this comment

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

Thank you @peasee this looks good to me! I can't approve the pipelines to run, but I did check this out locally and manually ran some checks (all of which passed).

@alamb could you kick off the github actions for this one?

@alamb alamb changed the title feat: Add DateFieldExtractStyle::Strftime support for SqliteDialect feat: Add DateFieldExtractStyle::Strftime support for SqliteDialect unparser Sep 2, 2024
@alamb
Copy link
Contributor

alamb commented Sep 2, 2024

Thank you @peasee this looks good to me! I can't approve the pipelines to run, but I did check this out locally and manually ran some checks (all of which passed).

@alamb could you kick off the github actions for this one?

Thanks @devinjdangelo -- sorry for the delay, I was out last week and am catching up

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.

The code looks good to me too -- thank you @peasee and @devinjdangelo

@alamb alamb merged commit 0cd7c25 into apache:main Sep 3, 2024
24 checks passed
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.

Bug: SQLite unparser does not support date extraction functions
3 participants