@@ -1535,25 +1535,31 @@ def _set_selection(self, indexer, value, fields=None):
1535
1535
check_array_shape ('value' , value , sel_shape )
1536
1536
1537
1537
# iterate over chunks in range
1538
- for chunk_coords , chunk_selection , out_selection in indexer :
1538
+ if not hasattr (self .store , "setitems" ) or self ._synchronizer is not None :
1539
+ # iterative approach
1540
+ for chunk_coords , chunk_selection , out_selection in indexer :
1539
1541
1540
- # extract data to store
1541
- if sel_shape == ():
1542
- chunk_value = value
1543
- elif is_scalar (value , self ._dtype ):
1544
- chunk_value = value
1545
- else :
1546
- chunk_value = value [out_selection ]
1547
- # handle missing singleton dimensions
1548
- if indexer .drop_axes :
1549
- item = [slice (None )] * self .ndim
1550
- for a in indexer .drop_axes :
1551
- item [a ] = np .newaxis
1552
- item = tuple (item )
1553
- chunk_value = chunk_value [item ]
1554
-
1555
- # put data
1556
- self ._chunk_setitem (chunk_coords , chunk_selection , chunk_value , fields = fields )
1542
+ # extract data to store
1543
+ if sel_shape == ():
1544
+ chunk_value = value
1545
+ elif is_scalar (value , self ._dtype ):
1546
+ chunk_value = value
1547
+ else :
1548
+ chunk_value = value [out_selection ]
1549
+ # handle missing singleton dimensions
1550
+ if indexer .drop_axes :
1551
+ item = [slice (None )] * self .ndim
1552
+ for a in indexer .drop_axes :
1553
+ item [a ] = np .newaxis
1554
+ item = tuple (item )
1555
+ chunk_value = chunk_value [item ]
1556
+
1557
+ # put data
1558
+ self ._chunk_setitem (chunk_coords , chunk_selection , chunk_value , fields = fields )
1559
+ else :
1560
+ lchunk_coords , lchunk_selection , lout_selection = zip (* indexer )
1561
+ self ._chunk_setitems (lchunk_coords , lchunk_selection , out , lout_selection ,
1562
+ fields = fields )
1557
1563
1558
1564
def _process_chunk (self , out , cdata , chunk_selection , drop_axes ,
1559
1565
out_is_ndarray , fields , out_selection ):
0 commit comments