src/datasets/table.py
def fast_slice(self, offset=0, length=None) -> pa.Table:
        """
        Slice the Table using interpolation search.
        The behavior is the same as :obj:`pyarrow.Table.slice` but it's significantly faster.

        Interpolation search is used to find the start and end indexes of the batches we want to keep.
        The batches to keep are then concatenated to form the sliced Table.
        """
        if offset < 0:
            raise IndexError("Offset must be non-negative")
        elif offset >= self._offsets[-1] or (length is not None and length <= 0):
            return pa.Table.from_batches([], schema=self._schema)
        i = _interpolation_search(self._offsets, offset)
        if length is None or length + offset >= self._offsets[-1]:
            batches = self._batches[i:]
            batches[0] = batches[0].slice(offset - self._offsets[i])
        else:
            j = _interpolation_search(self._offsets, offset + length - 1)
            batches = self._batches[i : j + 1]
            batches[-1] = batches[-1].slice(0, offset + length - self._offsets[j])
            batches[0] = batches[0].slice(offset - self._offsets[i])
        return pa.Table.from_batches(batches, schema=self._schema)

        Slice the Table using interpolation search.
        The behavior is the same as :obj:`pyarrow.Table.slice` but it's significantly faster.

        Interpolation search is used to find the start and end indexes of the batches we want to keep.
        The batches to keep are then concatenated to form the sliced Table.
        
Slice the Table using interpolation search.
The behavior is the same as :obj:`pyarrow.Table.slice` but it's significantly faster.

Interpolation search is used to find the start and end indexes of the batches we want to keep.
The batches to keep are then concatenated to form the sliced Table.
Slice the Table using interpolation search . The behavior is the same as : obj : ` pyarrow . Table . slice ` but it ' s significantly faster . Interpolation search is used to find the start and end indexes of the batches we want to keep . The batches to keep are then concatenated to form the sliced Table .
def fast_slice(self, offset=0, length=None) -> pa.Table:
        if offset < 0:
            raise IndexError("Offset must be non-negative")
        elif offset >= self._offsets[-1] or (length is not None and length <= 0):
            return pa.Table.from_batches([], schema=self._schema)
        i = _interpolation_search(self._offsets, offset)
        if length is None or length + offset >= self._offsets[-1]:
            batches = self._batches[i:]
            batches[0] = batches[0].slice(offset - self._offsets[i])
        else:
            j = _interpolation_search(self._offsets, offset + length - 1)
            batches = self._batches[i : j + 1]
            batches[-1] = batches[-1].slice(0, offset + length - self._offsets[j])
            batches[0] = batches[0].slice(offset - self._offsets[i])
        return pa.Table.from_batches(batches, schema=self._schema)
def fast_slice ( self , offset = 0 , length = None ) -> pa . Table : if offset < 0 : raise IndexError ( "Offset must be non-negative" ) elif offset >= self . _offsets [ - 1 ] or ( length is not None and length <= 0 ) : return pa . Table . from_batches ( [ ] , schema = self . _schema ) i = _interpolation_search ( self . _offsets , offset ) if length is None or length + offset >= self . _offsets [ - 1 ] : batches = self . _batches [ i : ] batches [ 0 ] = batches [ 0 ] . slice ( offset - self . _offsets [ i ] ) else : j = _interpolation_search ( self . _offsets , offset + length - 1 ) batches = self . _batches [ i : j + 1 ] batches [ - 1 ] = batches [ - 1 ] . slice ( 0 , offset + length - self . _offsets [ j ] ) batches [ 0 ] = batches [ 0 ] . slice ( offset - self . _offsets [ i ] ) return pa . Table . from_batches ( batches , schema = self . _schema )
Slice the Table using interpolation search.
Slice the Table using interpolation search .
"""
        Slice the Table using interpolation search.
        The behavior is the same as :obj:`pyarrow.Table.slice` but it's significantly faster.

        Interpolation search is used to find the start and end indexes of the batches we want to keep.
        The batches to keep are then concatenated to form the sliced Table.
        """
self
offset
length