Skip to content

Broadcast several chunked arrays over a dimension without chunks - #355

Draft
oschulz wants to merge 1 commit into
JuliaIO:mainfrom
oschulz:broadcast-empty-dims
Draft

oschulz wants to merge 1 commit into
JuliaIO:mainfrom
oschulz:broadcast-empty-dims

Conversation

@oschulz

@oschulz oschulz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

This PR was prepared by Claude (Anthropic) in Claude Code, a Fable 5.2 session at xhigh effort, and cross-reviewed with OpenAI Codex, under the guidance of @oschulz, who will review it before marking it ready.

Broadcasting several chunked disk arrays throws if one of them has a chunk grid without chunks along a dimension, as empty views can have:

using DiskArrays, DiskArrays.TestTypes
a = ChunkedDiskArray(collect(1.0:10); chunksize=(3,))
collect(view(a, 1:0) .+ view(a, 3:2))  # BoundsError: attempt to access 0-element RegularChunks at index [1]

To decide whether an argument spans a dimension, common_chunks compares the start of its first chunk with the end of its last chunk, and here there are none. With this PR an argument without chunks along a dimension is treated like one that does not span it.

This came up while basing the arrays of LegendHDF5IO.jl on DiskArrays (the package is public, but registered in the LEGEND registry rather than in General). Its release notes currently list broadcasts of several empty arrays as a known limitation.

With several chunked arguments, common_chunks decides whether an argument
spans a dimension by comparing the start of its first chunk with the end
of its last chunk. A chunk grid without chunks, as empty views can have,
has neither, so broadcasting such arrays threw a BoundsError.

An argument without chunks along a dimension is now treated like one that
does not span it.

Assisted-By: generative AI

This branch has not been deployed

No deployments
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.

1 participant