apache / apache/datafusion

panic: array_repeat list path overflows inner element count multiplication

Open Beginner friendly
#22,219 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Describe the bug

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

### To Reproduce

```sql
SELECT array_repeat([1,2,3], 9223372036854775807);
```

### Actual behavior

```text
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.

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.