Repository: dask/dask

Issue:
reading parquet with multiindex works with pyarrow and fails with fastparquet (default)
<!-- Please include a self-contained copy-pastable example that generates the issue if possible.

Please be concise with code posted. See guidelines below on how to provide a good bug report:

- Craft Minimal Bug Reports http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
- Minimal Complete Verifiable Examples https://stackoverflow.com/help/mcve

Bug reports that follow these guidelines are easier to diagnose, and so are often handled much more quickly.
-->

**What happened**:

`dd.read_parquet("df.parquet", index=["timestamp", "name"], columns="x")` gives

```
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-49-6fe5f8a67117> in <module>
----> 1 dd.read_parquet("df.parquet", index=["timestamp", "name"], columns="x")

~/miniconda/envs/main/lib/python3.8/site-packages/dask/dataframe/io/parquet/core.py in read_parquet(path, columns, filters, categories, index, storage_options, engine, gather_statistics, split_row_groups, read_from_paths, chunksize, **kwargs)
    257 
    258     if isinstance(columns, str):
--> 259         df = read_parquet(
    260             path,
    261             columns=[columns],

~/miniconda/envs/main/lib/python3.8/site-packages/dask/dataframe/io/parquet/core.py in read_parquet(path, columns, filters, categories, index, storage_options, engine, gather_statistics, split_row_groups, read_from_paths, chunksize, **kwargs)
    305         index = [index]
    306 
--> 307     read_metadata_result = engine.read_metadata(
    308         fs,
    309         paths,

~/miniconda/envs/main/lib/python3.8/site-packages/dask/dataframe/io/parquet/fastparquet.py in read_metadata(cls, fs, paths, categories, index, gather_statistics, filters, split_row_groups, **kwargs)
    688             categories,
    689             index,
--> 690         ) = cls._generate_dd_meta(pf, index, categories)
    691 
    692         # Break `pf` into a list of `parts`

~/miniconda/envs/main/lib/python3.8/site-packages/dask/dataframe/io/parquet/fastparquet.py in _generate_dd_meta(cls, pf, index, categories)
    255         # fastparquet doesn't handle multiindex
    256         if len(index_names) > 1:
--> 257             raise ValueError("Cannot read DataFrame with MultiIndex.")
    258 
    259         for cat in categories:

ValueError: Cannot read DataFrame with MultiIndex.
```

**What you expected to happen**:

DataFrame loads. Desired behavior is same as `dd.read_parquet("df.parquet", engine="pyarrow", index=["timestamp", "name"], columns="x")`

**Minimal Complete Verifiable Example**:

```python
import dask
import dask.dataframe as dd

df = dask.datasets.timeseries(start="2000-01-01", end="2000-01-03")
df = df.reset_index()

df.to_parquet("df.parquet", engine="pyarrow")

dd.read_parquet("df.parquet", index=["timestamp", "name"], columns="x")
# Get error as above

# You can read it using
df = dd.read_parquet("df.parquet", engine="pyarrow", index=["timestamp", "name"], columns="x")
# which you should do as you saved it using pyarrow

# You can now do a group by operation
df.groupby(by=["timestamp", "name"]).max().compute()
```

**Anything else we need to know?**:

Came across this via https://github.com/intake/intake-parquet. Default `.read()` was failing as it uses fastparquet by default.

Could simply update the `ValueError` from `Cannot read DataFrame with MultiIndex` to `fastparquet cannot read DataFrame with MultiIndex` to make a bit more explicit

**Environment**:

- Dask version: 2021.04.0
- Python version: 3.8
- Operating System: mac
- Install method (conda, pip, source): conda



Discussion:

Resolving patch:
diff --git a/dask/dataframe/io/parquet/fastparquet.py b/dask/dataframe/io/parquet/fastparquet.py
--- a/dask/dataframe/io/parquet/fastparquet.py
+++ b/dask/dataframe/io/parquet/fastparquet.py
@@ -254,7 +254,7 @@ def _generate_dd_meta(cls, pf, index, categories):
 
         # fastparquet doesn't handle multiindex
         if len(index_names) > 1:
-            raise ValueError("Cannot read DataFrame with MultiIndex.")
+            raise ValueError("fastparquet cannot read DataFrame with MultiIndex.")
 
         for cat in categories:
             if cat in meta:


Test patch: