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

Support AT TIME ZONE clause #9647

Merged
merged 1 commit into from
Mar 17, 2024
Merged

Conversation

tinfoil-knight
Copy link
Contributor

Which issue does this PR close?

Closes #9580 .

Rationale for this change

AT TIME ZONE clause wasn't supported by DataFusion. For eg:

SELECT '2000-12-01 04:04:12' AT TIME ZONE 'America/New_York');

would earlier lead to this error: This feature is not implemented: Unsupported ast node in sqltorel: AtTimeZone

Now, the query evaluates to:

+-----------------------------+
| Utf8("2000-12-01 04:04:12") |
+-----------------------------+
| 2000-12-01T04:04:12-05:00   |
+-----------------------------+

What changes are included in this PR?

This PR adds support for converting AtTimeZone expression provided by sqlparser-rs to a logical expression in DataFusion.

Are these changes tested?

Yes. New tests have been added for expected behaviour and error scenarios.

Are there any user-facing changes?

Yes. The addition of AT TIME ZONE clause is a user facing change.

No breaking change since this PR only adds support for a previously unsupported clause.

@github-actions github-actions bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels Mar 16, 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.

Looks good to me -- thank you @tinfoil-knight

@alamb alamb merged commit cf0f8ee into apache:main Mar 17, 2024
23 checks passed
@tinfoil-knight tinfoil-knight deleted the 9580-at-time-zone branch March 17, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support AtTimeZone node in SqlToRel
2 participants