Repository: modin-project/modin

Issue:
Rename `read_pickle_distributed/to_pickle_distributed` to ` read_pickle_glob/to_pickle_glob`
For consistency with other functions like `read_csv_glob` and `read_parquet_glob`.


Discussion:
Hi 👋, I'd like to work on this simple issue if it's alright with you. 
Hi @npochhi, it would be great if you could help us with this. Please note that this is not a simple renaming. We should also preserve backward compatibility for a few future Modin releases. You can open a PR where we discuss more.

Patch:
diff --git a/modin/core/execution/dask/implementations/pandas_on_dask/io/io.py b/modin/core/execution/dask/implementations/pandas_on_dask/io/io.py
--- a/modin/core/execution/dask/implementations/pandas_on_dask/io/io.py
+++ b/modin/core/execution/dask/implementations/pandas_on_dask/io/io.py
@@ -111,10 +111,10 @@ def __make_write(*classes, build_args=build_args):
         ExperimentalGlobDispatcher,
         build_args={**build_args, "base_write": BaseIO.to_xml},
     )
-    read_pickle_distributed = __make_read(
+    read_pickle_glob = __make_read(
         ExperimentalPandasPickleParser, ExperimentalGlobDispatcher
     )
-    to_pickle_distributed = __make_write(
+    to_pickle_glob = __make_write(
         ExperimentalGlobDispatcher,
         build_args={**build_args, "base_write": BaseIO.to_pickle},
     )
diff --git a/modin/core/execution/dispatching/factories/dispatcher.py b/modin/core/execution/dispatching/factories/dispatcher.py
--- a/modin/core/execution/dispatching/factories/dispatcher.py
+++ b/modin/core/execution/dispatching/factories/dispatcher.py
@@ -197,9 +197,9 @@ def read_csv_glob(cls, **kwargs):
         return cls.get_factory()._read_csv_glob(**kwargs)
 
     @classmethod
-    @_inherit_docstrings(factories.PandasOnRayFactory._read_pickle_distributed)
-    def read_pickle_distributed(cls, **kwargs):
-        return cls.get_factory()._read_pickle_distributed(**kwargs)
+    @_inherit_docstrings(factories.PandasOnRayFactory._read_pickle_glob)
+    def read_pickle_glob(cls, **kwargs):
+        return cls.get_factory()._read_pickle_glob(**kwargs)
 
     @classmethod
     @_inherit_docstrings(factories.BaseFactory._read_json)
@@ -292,9 +292,9 @@ def to_pickle(cls, *args, **kwargs):
         return cls.get_factory()._to_pickle(*args, **kwargs)
 
     @classmethod
-    @_inherit_docstrings(factories.PandasOnRayFactory._to_pickle_distributed)
-    def to_pickle_distributed(cls, *args, **kwargs):
-        return cls.get_factory()._to_pickle_distributed(*args, **kwargs)
+    @_inherit_docstrings(factories.PandasOnRayFactory._to_pickle_glob)
+    def to_pickle_glob(cls, *args, **kwargs):
+        return cls.get_factory()._to_pickle_glob(*args, **kwargs)
 
     @classmethod
     @_inherit_docstrings(factories.PandasOnRayFactory._read_parquet_glob)
diff --git a/modin/core/execution/dispatching/factories/factories.py b/modin/core/execution/dispatching/factories/factories.py
--- a/modin/core/execution/dispatching/factories/factories.py
+++ b/modin/core/execution/dispatching/factories/factories.py
@@ -476,13 +476,13 @@ def _read_csv_glob(cls, **kwargs):
         source="Pickle files",
         params=_doc_io_method_kwargs_params,
     )
-    def _read_pickle_distributed(cls, **kwargs):
+    def _read_pickle_glob(cls, **kwargs):
         current_execution = get_current_execution()
         if current_execution not in supported_executions:
             raise NotImplementedError(
-                f"`_read_pickle_distributed()` is not implemented for {current_execution} execution."
+                f"`_read_pickle_glob()` is not implemented for {current_execution} execution."
             )
-        return cls.io_cls.read_pickle_distributed(**kwargs)
+        return cls.io_cls.read_pickle_glob(**kwargs)
 
     @classmethod
     @doc(
@@ -526,7 +526,7 @@ def _read_custom_text(cls, **kwargs):
         return cls.io_cls.read_custom_text(**kwargs)
 
     @classmethod
-    def _to_pickle_distributed(cls, *args, **kwargs):
+    def _to_pickle_glob(cls, *args, **kwargs):
         """
         Distributed pickle query compiler object.
 
@@ -540,9 +540,9 @@ def _to_pickle_distributed(cls, *args, **kwargs):
         current_execution = get_current_execution()
         if current_execution not in supported_executions:
             raise NotImplementedError(
-                f"`_to_pickle_distributed()` is not implemented for {current_execution} execution."
+                f"`_to_pickle_glob()` is not implemented for {current_execution} execution."
             )
-        return cls.io_cls.to_pickle_distributed(*args, **kwargs)
+        return cls.io_cls.to_pickle_glob(*args, **kwargs)
 
     @classmethod
     @doc(
diff --git a/modin/core/execution/ray/implementations/pandas_on_ray/io/io.py b/modin/core/execution/ray/implementations/pandas_on_ray/io/io.py
--- a/modin/core/execution/ray/implementations/pandas_on_ray/io/io.py
+++ b/modin/core/execution/ray/implementations/pandas_on_ray/io/io.py
@@ -113,10 +113,10 @@ def __make_write(*classes, build_args=build_args):
         ExperimentalGlobDispatcher,
         build_args={**build_args, "base_write": RayIO.to_xml},
     )
-    read_pickle_distributed = __make_read(
+    read_pickle_glob = __make_read(
         ExperimentalPandasPickleParser, ExperimentalGlobDispatcher
     )
-    to_pickle_distributed = __make_write(
+    to_pickle_glob = __make_write(
         ExperimentalGlobDispatcher,
         build_args={**build_args, "base_write": RayIO.to_pickle},
     )
diff --git a/modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py b/modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py
--- a/modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py
+++ b/modin/core/execution/unidist/implementations/pandas_on_unidist/io/io.py
@@ -113,10 +113,10 @@ def __make_write(*classes, build_args=build_args):
         ExperimentalGlobDispatcher,
         build_args={**build_args, "base_write": UnidistIO.to_xml},
     )
-    read_pickle_distributed = __make_read(
+    read_pickle_glob = __make_read(
         ExperimentalPandasPickleParser, ExperimentalGlobDispatcher
     )
-    to_pickle_distributed = __make_write(
+    to_pickle_glob = __make_write(
         ExperimentalGlobDispatcher,
         build_args={**build_args, "base_write": UnidistIO.to_pickle},
     )
diff --git a/modin/experimental/pandas/__init__.py b/modin/experimental/pandas/__init__.py
--- a/modin/experimental/pandas/__init__.py
+++ b/modin/experimental/pandas/__init__.py
@@ -33,13 +33,21 @@
 """
 
 from modin.pandas import *  # noqa F401, F403
+from modin.utils import func_from_deprecated_location
 
 from .io import (  # noqa F401
     read_csv_glob,
     read_custom_text,
     read_json_glob,
     read_parquet_glob,
-    read_pickle_distributed,
+    read_pickle_glob,
     read_sql,
     read_xml_glob,
 )
+
+read_pickle_distributed = func_from_deprecated_location(
+    "read_pickle_glob",
+    "modin.experimental.pandas.io",
+    "`modin.experimental.pandas.read_pickle_distributed` is deprecated and will be removed in a future version. "
+    + "Please use `modin.experimental.pandas.to_pickle_glob` instead.",
+)
diff --git a/modin/experimental/pandas/io.py b/modin/experimental/pandas/io.py
--- a/modin/experimental/pandas/io.py
+++ b/modin/experimental/pandas/io.py
@@ -303,7 +303,7 @@ def _read(**kwargs) -> DataFrame:
 
 
 @expanduser_path_arg("filepath_or_buffer")
-def read_pickle_distributed(
+def read_pickle_glob(
     filepath_or_buffer,
     compression: Optional[str] = "infer",
     storage_options: StorageOptions = None,
@@ -313,7 +313,7 @@ def read_pickle_distributed(
 
     This experimental feature provides parallel reading from multiple pickle files which are
     defined by glob pattern. The files must contain parts of one dataframe, which can be
-    obtained, for example, by `DataFrame.modin.to_pickle_distributed` function.
+    obtained, for example, by `DataFrame.modin.to_pickle_glob` function.
 
     Parameters
     ----------
@@ -344,11 +344,11 @@ def read_pickle_distributed(
 
     from modin.core.execution.dispatching.factories.dispatcher import FactoryDispatcher
 
-    return DataFrame(query_compiler=FactoryDispatcher.read_pickle_distributed(**kwargs))
+    return DataFrame(query_compiler=FactoryDispatcher.read_pickle_glob(**kwargs))
 
 
 @expanduser_path_arg("filepath_or_buffer")
-def to_pickle_distributed(
+def to_pickle_glob(
     self,
     filepath_or_buffer,
     compression: CompressionOptions = "infer",
@@ -392,7 +392,7 @@ def to_pickle_distributed(
 
     if isinstance(self, DataFrame):
         obj = self._query_compiler
-    FactoryDispatcher.to_pickle_distributed(
+    FactoryDispatcher.to_pickle_glob(
         obj,
         filepath_or_buffer=filepath_or_buffer,
         compression=compression,
diff --git a/modin/pandas/accessor.py b/modin/pandas/accessor.py
--- a/modin/pandas/accessor.py
+++ b/modin/pandas/accessor.py
@@ -22,6 +22,7 @@
 """
 
 import pickle
+import warnings
 
 import pandas
 from pandas._typing import CompressionOptions, StorageOptions
@@ -209,7 +210,7 @@ class ExperimentalFunctions:
     def __init__(self, data):
         self._data = data
 
-    def to_pickle_distributed(
+    def to_pickle_glob(
         self,
         filepath_or_buffer,
         compression: CompressionOptions = "infer",
@@ -248,9 +249,9 @@ def to_pickle_distributed(
             this argument with a non-fsspec URL. See the fsspec and backend storage
             implementation docs for the set of allowed keys and values.
         """
-        from modin.experimental.pandas.io import to_pickle_distributed
+        from modin.experimental.pandas.io import to_pickle_glob
 
-        to_pickle_distributed(
+        to_pickle_glob(
             self._data,
             filepath_or_buffer=filepath_or_buffer,
             compression=compression,
@@ -258,6 +259,22 @@ def to_pickle_distributed(
             storage_options=storage_options,
         )
 
+    def to_pickle_distributed(
+        self,
+        filepath_or_buffer,
+        compression: CompressionOptions = "infer",
+        protocol: int = pickle.HIGHEST_PROTOCOL,
+        storage_options: StorageOptions = None,
+    ) -> None:  # noqa
+        warnings.warn(
+            "`DataFrame.modin.to_pickle_distributed` is deprecated and will be removed in a future version. "
+            + "Please use `DataFrame.modin.to_pickle_glob` instead.",
+            category=FutureWarning,
+        )
+        return self.to_pickle_glob(
+            filepath_or_buffer, compression, protocol, storage_options
+        )
+
     def to_parquet_glob(
         self,
         path,


Test patch:
diff --git a/modin/experimental/pandas/test/test_io_exp.py b/modin/experimental/pandas/test/test_io_exp.py
--- a/modin/experimental/pandas/test/test_io_exp.py
+++ b/modin/experimental/pandas/test/test_io_exp.py
@@ -249,7 +249,11 @@ def _pandas_read_csv_glob(path, storage_options):
 @pytest.mark.parametrize(
     "filename", ["test_default_to_pickle.pkl", "test_to_pickle*.pkl"]
 )
-def test_distributed_pickling(tmp_path, filename, compression, pathlike):
+@pytest.mark.parametrize("read_func", ["read_pickle_glob", "read_pickle_distributed"])
+@pytest.mark.parametrize("to_func", ["to_pickle_glob", "to_pickle_distributed"])
+def test_distributed_pickling(
+    tmp_path, filename, compression, pathlike, read_func, to_func
+):
     data = test_data["int_data"]
     df = pd.DataFrame(data)
 
@@ -264,10 +268,8 @@ def test_distributed_pickling(tmp_path, filename, compression, pathlike):
         if filename_param == "test_default_to_pickle.pkl"
         else contextlib.nullcontext()
     ):
-        df.modin.to_pickle_distributed(
-            str(tmp_path / filename), compression=compression
-        )
-        pickled_df = pd.read_pickle_distributed(
+        getattr(df.modin, to_func)(str(tmp_path / filename), compression=compression)
+        pickled_df = getattr(pd, read_func)(
             str(tmp_path / filename), compression=compression
         )
     df_equals(pickled_df, df)