You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function zarr.utils.is_total_slice is used to determine if we can completely replace a chunk or if we need to first read it an merge it. Reading and merging is much more expensive than just overwriting, so this is a critical performance optimization.
There is a bug in this logic in the case of a chunk size of 1 (along any dimension). In this case indexing with an integer is the same as indexing with a length-1 slice. i.e. these two indexing operations are equivalent
a[0]
a[slice(0, 1)]
Unfortunately this function treats those two cases as different, incorrectly returning False for the former but True for the latter.
Steps to reproduce
importzarr# the first argument is the selection, the second argument is the chunk shapeassertzarr.util.is_total_slice((slice(0, 1),), (1,))
# this is an equivalent selection (without a slice) - currently evaluates to Falseassertnotzarr.util.is_total_slice((0,), (1,))
# same for multidimensional selectionassertzarr.util.is_total_slice((slice(0, 1), slice(0, 10)), (1, 10))
assertnotzarr.util.is_total_slice((0, slice(0, 10)), (1, 10))
Activity
Fix `is_total_slice` for size-1 dimensions
Fix `is_total_slice` for size-1 dimensions
Fix `is_total_slice` for size-1 dimensions
Fix `is_total_slice` for size-1 dimensions
Fix `is_total_slice` for size-1 dimensions (#1800)
V3 main sync w/ merge (#2335)