Skip to content

panic: interval analysis handle_overflow unreachable!() for DATE + INTERVAL near boundary #22233

@Dandandan

Description

@Dandandan

Describe the bug

Optimizer interval analysis hits unreachable!() when computing
properties for DATE + INTERVAL arithmetic near the date boundary.
handle_overflow at interval_arithmetic.rs:1168 panics rather than
returning the corresponding extreme value.

Same crash class as closed #14124 (Decimal128 unreachable in the same
module), but reached via DATE + INTERVAL. Still panics in 53.1.0.

To Reproduce

SELECT DATE '2262-04-10' + INTERVAL '999999999' DAY;

Actual behavior

thread 'main' panicked at datafusion/expr-common/src/interval_arithmetic.rs:1168:13:
internal error: entered unreachable code

Call path: handle_overflowadd_boundsInterval::add
BinaryExpr::get_properties.

Expected behavior

Return an execution/planning error about date arithmetic overflow.

Notes

Source: https://github.com/apache/datafusion/blob/53.1.0/datafusion/expr-common/src/interval_arithmetic.rs#L1168

Found via LLM-guided fuzz testing on DataFusion 53.1.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions