python/ray/data/impl/simple_block.py
def iter_groups() -> Iterator[Tuple[KeyType, Block]]:
            """Creates an iterator over zero-copy group views."""
            if key is None:
                # Global aggregation consists of a single "group", so we short-circuit.
                yield None, self.to_block()
                return

            start = end = 0
            iter = self.iter_rows()
            next_row = None
            # Use a bool to indicate if next_row is valid
            # instead of checking if next_row is None
            # since a row can have None value.
            has_next_row = False
            while True:
                try:
                    if not has_next_row:
                        next_row = next(iter)
                        has_next_row = True
                    next_key = key(next_row)
                    while key(next_row) == next_key:
                        end += 1
                        try:
                            next_row = next(iter)
                        except StopIteration:
                            has_next_row = False
                            next_row = None
                            break
                    yield next_key, self.slice(start, end, copy=False)
                    start = end
                except StopIteration:
                    break
Creates an iterator over zero-copy group views.
Creates an iterator over zero-copy group views.
Creates an iterator over zero - copy group views .
def iter_groups() -> Iterator[Tuple[KeyType, Block]]:
            if key is None:
                yield None, self.to_block()
                return
            start = end = 0
            iter = self.iter_rows()
            next_row = None
            has_next_row = False
            while True:
                try:
                    if not has_next_row:
                        next_row = next(iter)
                        has_next_row = True
                    next_key = key(next_row)
                    while key(next_row) == next_key:
                        end += 1
                        try:
                            next_row = next(iter)
                        except StopIteration:
                            has_next_row = False
                            next_row = None
                            break
                    yield next_key, self.slice(start, end, copy=False)
                    start = end
                except StopIteration:
                    break
def iter_groups ( ) -> Iterator [ Tuple [ KeyType , Block ] ] : if key is None : yield None , self . to_block ( ) return start = end = 0 iter = self . iter_rows ( ) next_row = None has_next_row = False while True : try : if not has_next_row : next_row = next ( iter ) has_next_row = True next_key = key ( next_row ) while key ( next_row ) == next_key : end += 1 try : next_row = next ( iter ) except StopIteration : has_next_row = False next_row = None break yield next_key , self . slice ( start , end , copy = False ) start = end except StopIteration : break
Creates an iterator over zero-copy group views.
Creates an iterator over zero - copy group views .
"""Creates an iterator over zero-copy group views.""" # Global aggregation consists of a single "group", so we short-circuit. # Use a bool to indicate if next_row is valid # instead of checking if next_row is None # since a row can have None value.