[GLUTEN-13010][VL] Support Arrow StringView for Velox batch loading - #13009
Open
WangGuangxin wants to merge 3 commits into
Open
[GLUTEN-13010][VL] Support Arrow StringView for Velox batch loading#13009WangGuangxin wants to merge 3 commits into
WangGuangxin wants to merge 3 commits into
Conversation
|
Run Gluten Clickhouse CI on x86 |
WangGuangxin
force-pushed
the
stringview
branch
from
September 13, 2026 08:17
1289236 to
ea00de8
Compare
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
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.
What changes are proposed in this pull request?
Previously, Velox exported VARCHAR and VARBINARY columns using Arrow’s traditional Utf8 and Binary layouts. These layouts store all values in one contiguous data buffer and use signed 32-bit offsets. Consequently, a column fails to export when its aggregate payload exceeds approximately 2 GiB, even if every individual value is small.
This PR adds an optional Arrow StringView export path for Velox-to-Java conversion. Utf8View and BinaryView use fixed-size descriptors that can reference multiple variadic data buffers, removing the requirement that an entire column fit in one contiguous buffer smaller than 2 GiB.
The change includes:
Exporting Velox strings as Utf8View/BinaryView through ColumnarBatches.load when supported.
Adding Java accessors for ViewVarCharVector and ViewVarBinaryVector.
Preserving View types during Arrow schema conversion.
Preserving variadic-buffer metadata during load → offload → load round trips.
Falling back to traditional Utf8/Binary when the Arrow runtime does not support StringView.
Keeping shuffle, serialization, and writer paths unchanged to limit compatibility impact.
This removes the approximately 2 GiB aggregate payload limit for a string or binary column in this conversion path. It does not support an individual value larger than approximately 2 GiB, and other paths that still use traditional Utf8/Binary retain the original limit.
Why did the previous path have a 2 GiB limit?
Traditional Arrow Utf8 and Binary arrays store all values in one contiguous data buffer and use signed 32-bit offsets:
validity buffer
offset buffer: [0, len0, len0 + len1, ...]
data buffer: all values stored contiguously
The last offset represents the column’s total payload size and cannot exceed Integer.MAX_VALUE (2,147,483,647). Therefore, conversion can fail when the aggregate payload of one column exceeds approximately 2 GiB, even if every individual value is small.
How does the new path bypass this limit?
Arrow Utf8View and BinaryView use fixed-size 16-byte descriptors. Short values can be stored inline, while longer values reference one of multiple variadic data buffers using a buffer index and offset.
This removes the requirement that all values in a column be stored in one contiguous buffer smaller than 2 GiB. The aggregate payload can therefore exceed 2 GiB by being distributed across multiple backing buffers.
What cases are still not addressed?
A single string or binary value larger than approximately 2 GiB is still unsupported because its length is represented using a 32-bit integer, and Java arrays and Spark UTF8String have similar limits.
Paths that still use traditional Utf8/Binary, such as shuffle, serialization, and writer paths, retain the original aggregate 2 GiB limit.
Environments without Arrow StringView support, such as the default Arrow 15/JDK 8 configuration, fall back to traditional Utf8/Binary.
Normal memory and allocator limits still apply. StringView avoids the contiguous-buffer offset limit; it does not provide unlimited capacity.
How was this patch tested?
Added tests covering:
Velox export using Utf8View and BinaryView.
Java access through ArrowWritableColumnVector and ArrowColumnVector.
Null, inline, and out-of-line View values.
View variadic-buffer metadata.
Velox → Arrow load and load → offload → load round trips.
Arrow 15 fallback compatibility.
Besides,
we can manually test using following scripts
test.scala
without this patch, exception is
Was this patch authored or co-authored using generative AI tooling?
Generated-by: GPT-5.6 Sol
Related issue: #13010