Skip to content

fix: prevent repeat from attempting impossible LargeUtf8 allocations - #27010

Closed
huong8373tt-beep wants to merge 1 commit into
apache:mainfrom
huong8373tt-beep:fix-repeat-largeutf8-allocation
Closed

huong8373tt-beep wants to merge 1 commit into
apache:mainfrom
huong8373tt-beep:fix-repeat-largeutf8-allocation

Conversation

@huong8373tt-beep

Copy link
Copy Markdown

Which issue does this close?

Closes #26948.

Rationale for this change

repeat previously allowed LargeUtf8 results up to i64::MAX bytes. A valid input such as repeat(LargeUtf8('Pg'), 1 << 60) therefore passed validation and then attempted an impossible allocation, aborting the process instead of returning a DataFusion error. The array path could likewise panic while reserving builder capacity.

What changes are included in this PR?

  • Use the same i32::MAX output cap for all three string representations (Utf8, Utf8View, and LargeUtf8) before allocation.
  • Add scalar and array regression tests for oversized LargeUtf8 results.

This keeps the existing error behavior and avoids changing builder internals or allocation semantics.

What is the testing strategy for this PR?

  • rustfmt --check on the changed Rust file
  • git diff --check

The local Cargo dependency check was attempted, but this Windows environment lacks a usable Rust toolchain/cache for the repository dependencies; the focused regression tests are included for CI.

Are there any user-facing changes?

Oversized repeat results now return the normal string-size overflow error for LargeUtf8 instead of aborting or panicking.

Disclosure

Slai Agent Runtime performed the investigation, implementation, and test execution. The account owner authorized this contribution and is responsible for its content.

Created with: Slai Agent Runtime

@github-actions github-actions Bot added the functions Changes to functions implementation label Nov 2, 2026
@huong8373tt-beep

Copy link
Copy Markdown
Author

Closing this duplicate now that the same issue is already covered by PR #26957. No further action is needed from maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repeat on LargeUtf8 aborts the process on a result size no allocation can satisfy

1 participant