Skip to content

[python] Add zero-copy coalesced BLOB range views#8726

Merged
JingsongLi merged 2 commits into
apache:masterfrom
XiaoHongbo-Hope:zero_copy
Jul 20, 2026
Merged

[python] Add zero-copy coalesced BLOB range views#8726
JingsongLi merged 2 commits into
apache:masterfrom
XiaoHongbo-Hope:zero_copy

Conversation

@XiaoHongbo-Hope

@XiaoHongbo-Hope XiaoHongbo-Hope commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Purpose

Add bounded shared views for coalesced BLOB reads without changing the existing bytes API. Daft uses the views directly, and process-local training loaders can reuse them.

Tests

Added shared/sparse view and Arrow conversion coverage. Passed BLOB and Daft BLOB tests; targeted view tests also pass on Python 3.6.

Keep the existing bytes API unchanged while adding bounded buffer-protocol views for consumers that own the payload lifetime. Daft builds binary arrays directly from those views, and worker-local training loaders can reuse the same API before decoding tensors.
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review July 19, 2026 08:06
leaves12138
leaves12138 previously approved these changes Jul 19, 2026

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The new view API preserves the existing bytes-returning API, avoids per-member Python bytes slices for dense coalesced spans, and bounds retained gap memory for sparse spans without giving up coalesced I/O. The Daft batch path also accepts the resulting Arrow array correctly. I verified the three targeted coalesced-range tests and all five Daft BLOB read tests locally with Daft 0.7.11.

@leaves12138
leaves12138 dismissed their stale review July 19, 2026 08:31

Submitted by mistake; this review was intended to be shared privately.

@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit b7a688c into apache:master Jul 20, 2026
7 checks passed
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.

3 participants