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