From 3a92811d93d541b794990b8e5086db650bd0c15f Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Mon, 16 Oct 2023 18:01:06 +0200 Subject: [PATCH] return None from lambda to speedup 'ip' computation Signed-off-by: Anatoly Myachev --- .../implementations/pandas_on_dask/partitioning/partition.py | 2 +- .../ray/implementations/pandas_on_ray/partitioning/partition.py | 2 +- .../implementations/pandas_on_unidist/partitioning/partition.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition.py b/modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition.py index d6679701fd3..827736cfc3b 100644 --- a/modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition.py +++ b/modin/core/execution/dask/implementations/pandas_on_dask/partitioning/partition.py @@ -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 if materialize and isinstance(self._ip_cache, Future): self._ip_cache = DaskWrapper.materialize(self._ip_cache) return self._ip_cache diff --git a/modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py b/modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py index 9235d6faabb..d0d0f37bc5c 100644 --- a/modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py +++ b/modin/core/execution/ray/implementations/pandas_on_ray/partitioning/partition.py @@ -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 if materialize and isinstance(self._ip_cache, ObjectIDType): self._ip_cache = RayWrapper.materialize(self._ip_cache) return self._ip_cache diff --git a/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py b/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py index 3959e88969a..262e8887e64 100644 --- a/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py +++ b/modin/core/execution/unidist/implementations/pandas_on_unidist/partitioning/partition.py @@ -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 if materialize and unidist.is_object_ref(self._ip_cache): self._ip_cache = UnidistWrapper.materialize(self._ip_cache) return self._ip_cache