File tree Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Expand file tree Collapse file tree 4 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1+ Improved performance of reading arrays by not unnecessarily using
2+ the fill value.
Original file line number Diff line number Diff line change @@ -427,6 +427,11 @@ async def read(
427427 The second slice selection determines where in the output array the chunk data will be written.
428428 The ByteGetter is used to fetch the necessary bytes.
429429 The chunk spec contains information about the construction of an array from the bytes.
430+
431+ If the Store returns ``None`` for a chunk, then the chunk was not
432+ written and the implementation must set the values of that chunk (or
433+ ``out``) to the fill value for the array.
434+
430435 out : NDBuffer
431436 """
432437 ...
Original file line number Diff line number Diff line change @@ -451,11 +451,10 @@ async def _decode_single(
451451 )
452452
453453 # setup output array
454- out = chunk_spec .prototype .nd_buffer .create (
454+ out = chunk_spec .prototype .nd_buffer .empty (
455455 shape = shard_shape ,
456456 dtype = shard_spec .dtype .to_native_dtype (),
457457 order = shard_spec .order ,
458- fill_value = 0 ,
459458 )
460459 shard_dict = await _ShardReader .from_bytes (shard_bytes , self , chunks_per_shard )
461460
@@ -498,11 +497,10 @@ async def _decode_partial_single(
498497 )
499498
500499 # setup output array
501- out = shard_spec .prototype .nd_buffer .create (
500+ out = shard_spec .prototype .nd_buffer .empty (
502501 shape = indexer .shape ,
503502 dtype = shard_spec .dtype .to_native_dtype (),
504503 order = shard_spec .order ,
505- fill_value = 0 ,
506504 )
507505
508506 indexed_chunks = list (indexer )
Original file line number Diff line number Diff line change @@ -1349,11 +1349,10 @@ async def _get_selection(
13491349 f"shape of out argument doesn't match. Expected { indexer .shape } , got { out .shape } "
13501350 )
13511351 else :
1352- out_buffer = prototype .nd_buffer .create (
1352+ out_buffer = prototype .nd_buffer .empty (
13531353 shape = indexer .shape ,
13541354 dtype = out_dtype ,
13551355 order = self .order ,
1356- fill_value = self .metadata .fill_value ,
13571356 )
13581357 if product (indexer .shape ) > 0 :
13591358 # need to use the order from the metadata for v2
You can’t perform that action at this time.
0 commit comments