Skip to content

Support automatic string --> interval casting #5652

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I would like to write a query like

select * from foo where x < now() - '1 day';

Here is what happens today

❯ create table foo(x timestamp) as select '2023-03-01'::timestamp;
0 rows in set. Query took 0.002 seconds.
❯ select * from foo;
+---------------------+
| x                   |
+---------------------+
| 2023-03-01T00:00:00 |
+---------------------+
1 row in set. Query took 0.001 seconds.
❯ select * from foo where x < now() - '1 day';
Internal error: The type of Timestamp(Nanosecond, Some("+00:00")) Minus Utf8 of binary physical should be same. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

Describe the solution you'd like
I would like the query to work (by adding coercion rules to automatically coerce string --> interval if appropriate)

Describe alternatives you've considered
N/A

Additional context
I think we will need to fix #5650 and #5651

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions