Skip to content

Commit

Permalink
return None from lambda to speedup 'ip' computation
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed Oct 16, 2023
1 parent e42e625 commit 3a92811
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def ip(self, materialize=True):
IP address of the node that holds the data.
"""
if self._ip_cache is None:
self._ip_cache = self.apply(lambda df: pandas.DataFrame([]))._ip_cache
self._ip_cache = self.apply(lambda df: None)._ip_cache

Check warning on line 310 in modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition.py#L310

Added line #L310 was not covered by tests
if materialize and isinstance(self._ip_cache, Future):
self._ip_cache = DaskWrapper.materialize(self._ip_cache)
return self._ip_cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def ip(self, materialize=True):
if len(self.call_queue):
self.drain_call_queue()
else:
self._ip_cache = self.apply(lambda df: pandas.DataFrame([]))._ip_cache
self._ip_cache = self.apply(lambda df: None)._ip_cache

Check warning on line 334 in modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py#L334

Added line #L334 was not covered by tests
if materialize and isinstance(self._ip_cache, ObjectIDType):
self._ip_cache = RayWrapper.materialize(self._ip_cache)
return self._ip_cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def ip(self, materialize=True):
if len(self.call_queue):
self.drain_call_queue()
else:
self._ip_cache = self.apply(lambda df: pandas.DataFrame([]))._ip_cache
self._ip_cache = self.apply(lambda df: None)._ip_cache

Check warning on line 305 in modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py

View check run for this annotation

Codecov / codecov/patch

modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py#L305

Added line #L305 was not covered by tests
if materialize and unidist.is_object_ref(self._ip_cache):
self._ip_cache = UnidistWrapper.materialize(self._ip_cache)
return self._ip_cache
Expand Down

0 comments on commit 3a92811

Please sign in to comment.