Skip to content

Add type coercion rule for date + interval#2235

Merged
Dandandan merged 1 commit intoapache:masterfrom
andygrove:type-coercion-date-interval
Apr 15, 2022
Merged

Add type coercion rule for date + interval#2235
Dandandan merged 1 commit intoapache:masterfrom
andygrove:type-coercion-date-interval

Conversation

@andygrove
Copy link
Copy Markdown
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
@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
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants