Skip to content

[BUG] Error when adding Date32 and Int64Β #12342

@comphead

Description

@comphead

Describe the bug

DataFusion 41

>  select to_date('1970-01-01', 'yyyy-mm-dd') + 5;
Error during planning: Cannot coerce arithmetic expression Date32 + Int64 to valid types

The same query runs ok in Postgres
Workaround

> select to_date('1970-01-01') + interval '5' day;
+-------------------------------------------------------------------------------------------------------------------+
| to_date(Utf8("1970-01-01")) + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }") |
+-------------------------------------------------------------------------------------------------------------------+
| 1970-01-06                                                                                                        |
+-------------------------------------------------------------------------------------------------------------------+

To Reproduce

 select to_date('1970-01-01', 'yyyy-mm-dd') + 5;

Expected behavior

Query should work

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions