diff --git a/python/ray/data/dataset.py b/python/ray/data/dataset.py index d4c8d887da34..599b62f30948 100644 --- a/python/ray/data/dataset.py +++ b/python/ray/data/dataset.py @@ -3811,9 +3811,7 @@ def iterator(self) -> DataIterator: @ConsumptionAPI @PublicAPI(api_group=CD_API_GROUP) - def iter_rows( - self, *, prefetch_batches: int = 1, prefetch_blocks: int = 0 - ) -> Iterable[Dict[str, Any]]: + def iter_rows(self) -> Iterable[Dict[str, Any]]: """Return an iterable over the rows in this dataset. Examples: @@ -3826,18 +3824,10 @@ def iter_rows( Time complexity: O(1) - Args: - prefetch_batches: The number of batches to prefetch ahead of the current - batch during the scan. - prefetch_blocks: This argument is deprecated. Use ``prefetch_batches`` - instead. - Returns: An iterable over the rows in this dataset. """ - return self.iterator().iter_rows( - prefetch_batches=prefetch_batches, prefetch_blocks=prefetch_blocks - ) + return self.iterator().iter_rows() @ConsumptionAPI @PublicAPI(api_group=CD_API_GROUP) diff --git a/python/ray/data/iterator.py b/python/ray/data/iterator.py index 57d0c2e7c05f..58e9a1b7355e 100644 --- a/python/ray/data/iterator.py +++ b/python/ray/data/iterator.py @@ -1,6 +1,5 @@ import abc import time -import warnings from typing import ( TYPE_CHECKING, Any, @@ -188,9 +187,7 @@ def _create_iterator() -> Iterator[DataBatch]: def _get_dataset_tag(self) -> str: return "unknown_dataset" - def iter_rows( - self, *, prefetch_batches: int = 1, prefetch_blocks: int = 0 - ) -> Iterable[Dict[str, Any]]: + def iter_rows(self) -> Iterable[Dict[str, Any]]: """Return a local row iterable over the dataset. If the dataset is a tabular dataset (Arrow/Pandas blocks), dicts @@ -205,34 +202,12 @@ def iter_rows( Time complexity: O(1) - Args: - prefetch_batches: The number of batches to prefetch ahead of the current - batch during the scan. - prefetch_blocks: This argument is deprecated. Use ``prefetch_batches`` - instead. - Returns: An iterable over rows of the dataset. """ - iter_batch_args = { - "batch_size": None, - "batch_format": None, - "prefetch_batches": prefetch_batches, - } - if prefetch_blocks > 0: - warnings.warn( - "`prefetch_blocks` is deprecated in Ray 2.10. Use " - "the `prefetch_batches` parameter to specify the amount of prefetching " - "in terms of batches instead of blocks.", - DeprecationWarning, - ) - iter_batch_args["prefetch_batches"] = prefetch_blocks - if prefetch_batches != 1: - warnings.warn( - "`prefetch_batches` is deprecated in Ray 2.12.", DeprecationWarning - ) - - batch_iterable = self.iter_batches(**iter_batch_args) + batch_iterable = self.iter_batches( + batch_size=None, batch_format=None, prefetch_batches=1 + ) def _wrapped_iterator(): for batch in batch_iterable: diff --git a/python/ray/data/tests/test_consumption.py b/python/ray/data/tests/test_consumption.py index b4e63d20a7cf..d359a1fa2585 100644 --- a/python/ray/data/tests/test_consumption.py +++ b/python/ray/data/tests/test_consumption.py @@ -789,11 +789,6 @@ def to_pylist(table): assert isinstance(row, dict) assert row == df_row.to_dict() - # Prefetch. - for row, t_row in zip(ds.iter_rows(prefetch_batches=1), to_pylist(t)): - assert isinstance(row, dict) - assert row == t_row - def test_iter_batches_basic(ray_start_regular_shared): df1 = pd.DataFrame({"one": [1, 2, 3], "two": [2, 3, 4]})