Skip to content

Commit f4b2bcc

Browse files
committed
.coords -> .chunk_coords in _ChunkCoordsByteSlice dataclass
1 parent f7d5de3 commit f4b2bcc

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

changes/3004.feature.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ After any coalescing, the resulting byte ranges are read in parallel.
44

55
Coalescing respects two config options. Reads are coalesced if there are fewer
66
than `sharding.read.coalesce_max_gap_bytes` bytes between chunks and the total
7-
size of the coalesced read is no more than `sharding.read.coalesce_max_bytes`.
7+
size of the coalesced read is no more than `sharding.read.coalesce_max_bytes`.

src/zarr/codecs/sharding.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from enum import Enum
66
from functools import lru_cache
77
from operator import itemgetter
8-
from typing import TYPE_CHECKING, Any, NamedTuple, cast
8+
from typing import TYPE_CHECKING, Any, NamedTuple
99

1010
import numpy as np
1111
import numpy.typing as npt
@@ -220,10 +220,11 @@ def __iter__(self) -> Iterator[tuple[int, ...]]:
220220
return c_order_iter(self.index.offsets_and_lengths.shape[:-1])
221221

222222

223-
class _ChunkCoordsByteSlice(NamedTuple):
224-
"""Holds a chunk's coordinates and its byte range in a serialized shard."""
223+
@dataclass(frozen=True)
224+
class _ChunkCoordsByteSlice:
225+
"""Holds a core.indexing.ChunkProjection.chunk_coords and its byte range in a serialized shard."""
225226

226-
coords: tuple[int, ...]
227+
chunk_coords: tuple[int, ...]
227228
byte_slice: slice
228229

229230

@@ -800,7 +801,7 @@ async def _get_group_bytes(
800801
chunk.byte_slice.start - group_start,
801802
chunk.byte_slice.stop - group_start,
802803
)
803-
shard_dict[chunk.coords] = group_bytes[chunk_slice]
804+
shard_dict[chunk.chunk_coords] = group_bytes[chunk_slice]
804805

805806
return shard_dict
806807

0 commit comments

Comments
 (0)