Skip to content

Fix IndexOutOfBoundsException in ArrowArrayWriter when element count exceeds INITIAL_CAPACITY#2287

Closed
platinumhamburg wants to merge 1 commit into
apache:mainfrom
platinumhamburg:fix-array-arrow
Closed

Fix IndexOutOfBoundsException in ArrowArrayWriter when element count exceeds INITIAL_CAPACITY#2287
platinumhamburg wants to merge 1 commit into
apache:mainfrom
platinumhamburg:fix-array-arrow

Conversation

@platinumhamburg

@platinumhamburg platinumhamburg commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

Root cause: ArrowArrayWriter incorrectly used parent row's handleSafe flag (based on row count) for element writers, while element indices are based on cumulative element count. When row count < 1024 but total array elements > 1024, IndexOutOfBoundsException occurred.

Solution: ArrowArrayWriter now calculates elementHandleSafe based on actual element index instead of inheriting parent's handleSafe flag.

Added comprehensive test covering multiple arrays, nested arrays, and mixed column types.

Purpose

Linked issue: close #2164

Brief change log

Tests

API and Format

Documentation

…lement count exceeds INITIAL_CAPACITY

Root cause: ArrowArrayWriter incorrectly used parent row's handleSafe flag (based on row count) for element writers, while element indices are based on cumulative element count. When row count < 1024 but total array elements > 1024, IndexOutOfBoundsException occurred.

Solution: ArrowArrayWriter now calculates elementHandleSafe based on actual element index instead of inheriting parent's handleSafe flag.

Added comprehensive test covering multiple arrays, nested arrays, and mixed column types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] IndexOutOfBoundsException when writing rows with array columns to KV table

1 participant