fix(encoding): use LargeList internally for Utf8/Binary to prevent offset overflow#6811
Open
beinan wants to merge 10 commits into
Open
fix(encoding): use LargeList internally for Utf8/Binary to prevent offset overflow#6811beinan wants to merge 10 commits into
beinan wants to merge 10 commits into
Conversation
…fset overflow When reading large fragments containing variable-length data (like strings or binary), PyArrow's 32-bit (2 GiB) offset limit can be easily exceeded, resulting in a cryptic `Offset overflow error: 2151740513` panic. This updates the decoder to always use `LargeList<UInt8>` (i64 offsets) internally. When targeting `Utf8` or `Binary` arrays, `BinaryArrayDecoder` will safely downcast to i32 offsets if the chunk data fits within 2 GiB. If the chunk strictly exceeds 2 GiB, it now panics with a descriptive error suggesting a batch size reduction or switching to LargeUtf8/LargeBinary. Fixes lance-format#2775. Co-Authored-By: Beinan Wang <beinanwang@microsoft.com>
Contributor
Author
|
I ran some quick benchmarks on an x86 pod to measure the impact of the Here are the results comparing this branch against Standard UTF-8 Data (
Fixed-Length UTF-8 Data (
Overall, the safety and crash prevention added by the |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
added 6 commits
May 16, 2026 23:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When reading large fragments containing variable-length data (like strings or binary), PyArrow's 32-bit (2 GiB) offset limit can be easily exceeded, resulting in a cryptic
Offset overflow error: 2151740513panic.This updates the decoder to always use
LargeList<UInt8>(i64 offsets) internally. When targetingUtf8orBinaryarrays,BinaryArrayDecoderwill safely downcast to i32 offsets if the chunk data fits within 2 GiB. If the chunk strictly exceeds 2 GiB, it now panics with a descriptive error suggesting a batch size reduction or switching to LargeUtf8/LargeBinary.Fixes #2775.
🤖 Generated with MAI Agents