@@ -1459,11 +1459,6 @@ def __init__(self, store, s, func, where, nrows, start=None, stop=None,
1459
1459
stop = nrows
1460
1460
stop = min (nrows , stop )
1461
1461
1462
- # Piggy-back normalized `nrows` (considering start and stop) onto
1463
- # PyTables tables object so that the GenericIndexCol constructor
1464
- # knows how large the index should be.
1465
- self .s .table ._nrows_to_read = stop - start
1466
-
1467
1462
self .nrows = nrows
1468
1463
self .start = start
1469
1464
self .stop = stop
@@ -1632,7 +1627,7 @@ def infer(self, handler):
1632
1627
new_self .read_metadata (handler )
1633
1628
return new_self
1634
1629
1635
- def convert (self , values , nan_rep , encoding , errors ):
1630
+ def convert (self , values , nan_rep , encoding , errors , ** kwargs ):
1636
1631
""" set the values from this selection: take = take ownership """
1637
1632
1638
1633
# values is a recarray
@@ -1821,18 +1816,13 @@ class GenericIndexCol(IndexCol):
1821
1816
def is_indexed (self ):
1822
1817
return False
1823
1818
1824
- def convert (self , values , nan_rep , encoding , errors ):
1819
+ def convert (self , values , nan_rep , encoding , errors , ** kwargs ):
1825
1820
""" set the values from this selection: take = take ownership """
1826
1821
1827
- if hasattr (self .table , '_nrows_to_read' ):
1828
- # The `_nrows_to_read` property is set on the table object by the
1829
- # code path invoked by the top-level `read_hdf()`, and calculated
1830
- # based on the start` and `stop` integer values. These values allow
1831
- # for a sub-selection and likewise the index size needs to be
1832
- # adjusted to the size of this sub-selection.
1833
- self .values = Int64Index (np .arange (self .table ._nrows_to_read ))
1834
- else :
1835
- self .values = Int64Index (np .arange (self .table .nrows ))
1822
+ start = kwargs .get ('start' , 0 )
1823
+ stop = kwargs .get ('stop' , self .table .nrows )
1824
+ stop = min (stop , self .table .nrows )
1825
+ self .values = Int64Index (np .arange (stop - start ))
1836
1826
1837
1827
return self
1838
1828
@@ -2176,7 +2166,7 @@ def validate_attr(self, append):
2176
2166
raise ValueError ("appended items dtype do not match existing "
2177
2167
"items dtype in table!" )
2178
2168
2179
- def convert (self , values , nan_rep , encoding , errors ):
2169
+ def convert (self , values , nan_rep , encoding , errors , ** kwargs ):
2180
2170
"""set the data from this selection (and convert to the correct dtype
2181
2171
if we can)
2182
2172
"""
@@ -3448,8 +3438,10 @@ def read_axes(self, where, **kwargs):
3448
3438
# convert the data
3449
3439
for a in self .axes :
3450
3440
a .set_info (self .info )
3441
+ # `kwargs` may contain `start` and `stop` arguments if passed to
3442
+ # `store.select()`. If set they determine the index size.
3451
3443
a .convert (values , nan_rep = self .nan_rep , encoding = self .encoding ,
3452
- errors = self .errors )
3444
+ errors = self .errors , ** kwargs )
3453
3445
3454
3446
return True
3455
3447
0 commit comments