Repository: modin-project/modin

Issue:
BUG: Modin fails on reading parquet files with partitioned columns if path specified as a `pathlib.Path` object
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
import pandas
import modin.pandas as pd

file_name = "modin_issue#0000.parquet"

pandas.DataFrame({"a": [1, 2, 3, 4], "b": [1, 1, 2, 2]}).to_parquet(file_name, partition_cols=["b"])

df = pd.read_parquet(file_name) # 'default to pandas' warning.
print(df)

from pathlib import Path

df = pd.read_parquet(Path(file_name)) # InternalError
print(df)
```


### Issue Description

For some reason, when `Path` is passed modin tries to a read partitioned file anyway and fails as this case is not yet supported.

### Expected Behavior

fallback to pandas on unsupported operation

### Error Logs

<details>

```python-traceback

Traceback (most recent call last):
  File "t3.py", line 14, in <module>
    df = pd.read_parquet(Path(file_name)) # InternalError
  File "repos/modin/modin/logging/logger_decorator.py", line 128, in run_and_log
    return obj(*args, **kwargs)
  File "repos/modin/modin/pandas/io.py", line 313, in read_parquet
    query_compiler=FactoryDispatcher.read_parquet(
  File "repos/modin/modin/core/execution/dispatching/factories/dispatcher.py", line 180, in read_parquet
    return cls.get_factory()._read_parquet(**kwargs)
  File "repos/modin/modin/core/execution/dispatching/factories/factories.py", line 207, in _read_parquet
    return cls.io_cls.read_parquet(**kwargs)
  File "repos/modin/modin/logging/logger_decorator.py", line 128, in run_and_log
    return obj(*args, **kwargs)
  File "repos/modin/modin/core/io/file_dispatcher.py", line 164, in read
    if hasattr(query_compiler, "dtypes") and any(
  File "repos/modin/modin/core/storage_formats/pandas/query_compiler.py", line 300, in dtypes
    return self._modin_frame.dtypes
  File "repos/modin/modin/core/dataframe/pandas/dataframe/dataframe.py", line 299, in dtypes
    self._dtypes = self._compute_dtypes()
  File "repos/modin/modin/logging/logger_decorator.py", line 128, in run_and_log
    return obj(*args, **kwargs)
  File "repos/modin/modin/core/dataframe/pandas/dataframe/dataframe.py", line 318, in _compute_dtypes
    self.tree_reduce(0, lambda df: df.dtypes, dtype_builder)
  File "repos/modin/modin/logging/logger_decorator.py", line 128, in run_and_log
    return obj(*args, **kwargs)
  File "repos/modin/modin/core/dataframe/pandas/dataframe/dataframe.py", line 126, in run_f_on_minimally_updated_metadata
    result = f(self, *args, **kwargs)
  File "repos/modin/modin/core/dataframe/pandas/dataframe/dataframe.py", line 3343, in to_pandas
    ErrorMessage.catch_bugs_and_request_email(
  File "repos/modin/modin/error_message.py", line 80, in catch_bugs_and_request_email
    raise Exception(
Exception: Internal Error. Please visit https://github.com/modin-project/modin/issues to file an issue with the traceback and the command that caused this error. If you can't file a GitHub issue, please email bug_reports@modin.org.
Internal and external indices on axis 1 do not match.

```

</details>


### Installed Versions

<details>

Replace this line with the output of pd.show_versions()

</details>



Discussion:
This issue is relevant for optiver volatility benchmark
https://github.com/intel-ai/omniscripts/pull/357

Resolving patch:
diff --git a/modin/core/io/column_stores/parquet_dispatcher.py b/modin/core/io/column_stores/parquet_dispatcher.py
--- a/modin/core/io/column_stores/parquet_dispatcher.py
+++ b/modin/core/io/column_stores/parquet_dispatcher.py
@@ -21,6 +21,7 @@
 from fsspec.core import url_to_fs
 from fsspec.spec import AbstractBufferedFile
 import numpy as np
+from pandas.io.common import stringify_path
 from packaging import version
 
 from modin.core.storage_formats.pandas.utils import compute_chunksize
@@ -620,6 +621,7 @@ def _read(cls, path, engine, columns, **kwargs):
                 reason="Parquet options that are not currently supported",
                 **kwargs,
             )
+        path = stringify_path(path)
         if isinstance(path, list):
             # TODO(https://github.com/modin-project/modin/issues/5723): read all
             # files in parallel.


Test patch:
diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py
--- a/modin/pandas/test/test_io.py
+++ b/modin/pandas/test/test_io.py
@@ -1656,6 +1656,17 @@ def test_read_parquet_2462(self, engine):
 
             df_equals(test_df, read_df)
 
+    def test_read_parquet_5767(self, engine):
+        test_df = pandas.DataFrame({"a": [1, 2, 3, 4], "b": [1, 1, 2, 2]})
+        file_name = "modin_issue#0000.parquet"
+        with tempfile.TemporaryDirectory() as directory:
+            path = f"{directory}/data"
+            os.makedirs(path)
+            test_df.to_parquet(path + file_name, engine=engine, partition_cols=["b"])
+            read_df = pd.read_parquet(Path(path + file_name))
+        # both Modin and pandas read column "b" as a category
+        df_equals(test_df, read_df.astype("int64"))
+
     def test_read_parquet_5509(self, engine):
         test_df = pandas.DataFrame({"col_a": [1, 2, 3], "col_b": ["a", "b", "c"]})