Change Array.read Shape Argument long & Store Request Validation #54
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.
Changes
API Changes
Array.read()shape parameter fromint[]tolong[]for consistency withoffsetparameter and to support arrays with dimensions > 2GB (fixes ArrayMetadata.shape: long vs Array.read: int #29)ArrayAccessor.withShape()andIndexingUtilsmethods to uselong[]throughout the indexing pipelineCritical Bug Fixes
computeChunkCoords()by changingnumChunkstolongwith validation, preventing allocation failurescomputeProjection()for all long-to-int casts with descriptive error messages to prevent silent data truncationHTTP/S3 Store Fixes
RequestBody.fromBytes()for proper content-length specificationSecurity Fix
Performance Optimizations
Array.read()by removing theexists()check before reading chunks. This reduces I/O operations by 50% for reads, especially benefiting network stores (HTTP/S3) by removing redundant HEAD requests. Instead rely on returnednullvalues from store. (see "Enforced strict exception handling across all stores")ShardingIndexedCodecby efficiently returning fill values for missing shards without unnecessary allocations or exceptions.Exception Handling Improvements
FilesystemStore,HttpStore,ReadOnlyZipStore), ensuringnullis returned only for missing files/keys (NoSuchFileException/404) while all other I/O errors are propagated asStoreException.StoreExceptionclass with factory methods providing rich context (store path, key, underlying cause)IllegalStateExceptionfor programming errors andZarrExceptionfor user errors