Skip to content

Commit 563647f

Browse files
committed
remove listing existingKeys from array read
1 parent 2c7541f commit 563647f

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/main/java/dev/zarr/zarrjava/core/Array.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,6 @@ public ucar.ma2.Array read(final long[] offset, final int[] shape, final boolean
293293
if (parallel) {
294294
chunkStream = chunkStream.parallel();
295295
}
296-
297-
boolean isListableStore = storeHandle.store instanceof Store.ListableStore;
298-
Set<List<String>> existingKeys;
299-
if (isListableStore) {
300-
existingKeys = storeHandle.list().map(Arrays::asList).collect(Collectors.toSet());
301-
} else {
302-
existingKeys = null;
303-
}
304-
305296
chunkStream.forEach(
306297
chunkCoords -> {
307298
try {
@@ -320,11 +311,7 @@ public ucar.ma2.Array read(final long[] offset, final int[] shape, final boolean
320311
final String[] chunkKeys = metadata.chunkKeyEncoding().encodeChunkKey(chunkCoords);
321312
final StoreHandle chunkHandle = storeHandle.resolve(chunkKeys);
322313

323-
// chunkHandle.exists() can be expensive on some store types, so we optimize for ListableStore
324-
if (isListableStore) {
325-
if (existingKeys.stream().noneMatch(Arrays.asList(chunkKeys)::equals))
326-
return;
327-
} else if (!chunkHandle.exists()) return;
314+
if (!chunkHandle.exists()) return;
328315

329316
if (codecPipeline.supportsPartialDecode()) {
330317
final ucar.ma2.Array chunkArray = codecPipeline.decodePartial(chunkHandle,

0 commit comments

Comments
 (0)