apache / apache/datafusion

`rpad` function causes OOM

Open
#5,415 5 comments 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**
When I use the rpad function, and the parameter of the rpad function is large, it causes OOM.
Does Datafusion have a mechanism to limit the resources required for execution.

**To Reproduce**
```sql
create table test(a bigint) as values
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1),
(1), (1), (1), (1), (1);
select rpad('a', 1073741824, 'a') from test;
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing the SQL query with rpad('a', 1073741824, 'a') and trace the rpad execution path and any resource-limit handling; done should prevent the query from causing OOM, but the issue does not specify the expected limit behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.