panic: array_repeat list path overflows inner element count multiplication

Open Beginner friendly
#22,219 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
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
databases

Research direction

Start in datafusion/functions-nested/src/repeat.rs at the calculation around line 245, then run the SQL reproduction with the large repeat count. Check the existing array_repeat execution-error handling and add coverage for list-length multiplication overflow. Done means the query returns an execution error for output-size overflow instead of panicking.

Written by the indexing model from the issue text.

Description

bug
Describe the bug

array_repeat can panic for list inputs when len * count overflows while calculating the repeated inner value count.

To Reproduce
SELECT array_repeat([1,2,3], 9223372036854775807);
Actual behavior
thread 'main' panicked at datafusion/functions-nested/src/repeat.rs:245:32:
attempt to multiply with overflow
Expected behavior

Return an execution error for an output-size overflow instead of panicking.

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.