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

Add type coercion rule for date + interval #2235

Merged
merged 1 commit into from
Apr 15, 2022

Conversation

andygrove
Copy link
Member

@andygrove andygrove commented Apr 14, 2022

Signed-off-by: Andy Grove agrove@apache.org

Which issue does this PR close?

Closes ##2229.

Rationale for this change

Attempting to create a query plan from SQL using date + interval expressions was failing with a type-coercion error because no type coercion rule had been implemented for this operation.

What changes are included in this PR?

This PR implements the type coercion rule for date +/ interval, allowing the SQL query to be converted to a valid logical plan. This is sufficient for the use case of using DataFusion as SQL query planner.

A follow-on issue has been filed for implementing support for this expression in the physical planner:

Are there any user-facing changes?

No

No

Signed-off-by: Andy Grove <agrove@apache.org>
@andygrove andygrove self-assigned this Apr 14, 2022
@github-actions github-actions bot added the datafusion Changes in the datafusion crate label Apr 14, 2022
@andygrove andygrove marked this pull request as draft April 14, 2022 21:23
@andygrove andygrove marked this pull request as ready for review April 14, 2022 21:31
@liukun4515
Copy link
Contributor

the rule of type-coercion should be extracted if there are too many match or switch path

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 @andygrove Last time I tried something like this I got an error because the BinaryOperator implementation didn't support

Maybe it is worth starting to collect the necessary parts of this feature under #194

@andygrove andygrove deleted the type-coercion-date-interval branch January 27, 2023 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants