Skip to content

panic: repeat string array path overflows capacity calculation #22217

@Dandandan

Description

@Dandandan

Describe the bug

The array execution path for repeat(string, count) can panic on a large count because it multiplies string length by count before checking for overflow.

To Reproduce

SELECT repeat(x, 9223372036854775807)
FROM (VALUES ('abc')) AS t(x);

Actual behavior

thread 'main' panicked at datafusion/functions/src/string/repeat.rs:237:41:
attempt to multiply with overflow

Expected behavior

Return a string-size overflow error, as the scalar path already does, rather than panicking.

Notes

This reproducer uses a one-row input column so it reaches the array path without trying to allocate the full result.

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