Skip to content

panic: date_bin overflows scaling extreme Timestamp(Second) source #22211

@Dandandan

Description

@Dandandan

Describe the bug

date_bin can panic during planning/constant folding when it scales an extreme non-nanosecond timestamp source to nanoseconds.

To Reproduce

EXPLAIN SELECT date_bin(
  INTERVAL '1 nanosecond',
  arrow_cast(9223372036854775807, 'Timestamp(Second, None)'),
  TIMESTAMP '1970-01-01 00:00:00'
);

Actual behavior

thread 'main' panicked at datafusion/functions/src/datetime/date_bin.rs:585:47:
attempt to multiply with overflow

Expected behavior

Return a planning error for an out-of-range timestamp conversion instead of panicking.

Notes

This is the source timestamp conversion path; origin conversion has a separate panic site.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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