panic: date_bin overflows scaling extreme Time64(Microsecond) origin

Open Beginner friendly
#22,216 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust, sql
Domain
databases

Research direction

Start in datafusion/functions/src/datetime/date_bin.rs at the reported line and run the provided EXPLAIN query to reproduce the planning-time panic. Add coverage for the extreme Time64(Microsecond) origin and verify that the query returns a DataFusion error instead of panicking.

Written by the indexing model from the issue text.

Description

bug
Describe the bug

date_bin panics during planning/constant folding when scaling an extreme Time64(Microsecond) origin value.

To Reproduce
EXPLAIN SELECT date_bin(
  INTERVAL '1 microsecond',
  arrow_cast(0, 'Time64(Microsecond)'),
  arrow_cast(9223372036854775807, 'Time64(Microsecond)')
);
Actual behavior
thread 'main' panicked at datafusion/functions/src/datetime/date_bin.rs:532:14:
attempt to multiply with overflow
Expected behavior

Return a DataFusion error for the out-of-range origin conversion, not a panic.

Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 8h
Merged PRs (30d)
354

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/datafusion

All issues in apache/datafusion

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.