1717from zarr .core .common import concurrent_map
1818from zarr .core .config import config
1919from zarr .core .indexing import SelectorTuple , is_scalar
20- from zarr .errors import ZarrUserWarning
20+ from zarr .errors import MissingChunkError , ZarrUserWarning
2121from zarr .registry import register_pipeline
2222
2323if TYPE_CHECKING :
@@ -265,7 +265,10 @@ async def read_batch(
265265 if chunk_array is not None :
266266 out [out_selection ] = chunk_array
267267 else :
268- out [out_selection ] = fill_value_or_default (chunk_spec )
268+ if config .get ("codec_pipeline.fill_missing_chunks" , True ):
269+ out [out_selection ] = fill_value_or_default (chunk_spec )
270+ else :
271+ raise MissingChunkError ()
269272 else :
270273 chunk_bytes_batch = await concurrent_map (
271274 [(byte_getter , array_spec .prototype ) for byte_getter , array_spec , * _ in batch_info ],
@@ -289,7 +292,10 @@ async def read_batch(
289292 tmp = tmp .squeeze (axis = drop_axes )
290293 out [out_selection ] = tmp
291294 else :
292- out [out_selection ] = fill_value_or_default (chunk_spec )
295+ if config .get ("codec_pipeline.fill_missing_chunks" , True ):
296+ out [out_selection ] = fill_value_or_default (chunk_spec )
297+ else :
298+ raise MissingChunkError ()
293299
294300 def _merge_chunk_array (
295301 self ,
0 commit comments