Asthenia0412 opened a new pull request, #53728: URL: https://github.com/apache/arrow/pull/53728
## Background GH-53519 reports that `StringArray.from_buffers()` and `LargeStringArray.from_buffers()` reject valid 64-bit array counters with `OverflowError: value too large to convert to int`. The issue is that these specialized factory methods declare their `length`, `null_count`, and `offset` parameters as Cython `int` (32-bit C int), while the underlying Arrow `ArrayData` counters are `int64_t`. In contrast, the generic `Array.from_buffers()` method accepts unbounded Python integers and passes them through correctly to the C++ layer, which accepts `int64_t` parameters in `MakeWithChildren()`. ## Problem When users pass valid values above `INT32_MAX` (2\^31) to the specialized `StringArray.from_buffers()` or `LargeStringArray.from_buffers()`, Cython throws an `OverflowError` because the Python integer cannot fit into a 32-bit C `int`. This unnecessarily limits the API compared to the generic `Array.from_buffers()`. ## Solution Widen the three parameters (`length`, `null_count`, `offset`) from Cython `int` to `int64_t` in both `StringArray.from_buffers()` and `LargeStringArray.from_buffers()`. This aligns with: - The underlying C++ `ArrayData::MakeWithChildren()` signature which uses `int64_t` - The generic `Array.from_buffers()` which already accepts large integers - Other specialized factories in the same file (e.g., `DictionaryArray.from_buffers()` already uses `int64_t length`) ## Testing The change is a straightforward type widening: - The underlying C++ code already accepts `int64_t`, so no C++ changes are needed - No buffer layout changes - Normal string/binary buffer round-trips continue to work as before - Values up to `INT64_MAX` will now be accepted (though practical use is limited by address space) This fix was verified by code analysis against:\n- The issue's reproduction case\n- The `_ensure_compression()` patterns\n- Cython declaration conventions used elsewhere in the same file\n\n<!-- This closes GH-53519 -->\nCloses: #53519 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
