`Dataset.unique` showing wrong output after filtering
{'login': 'mxschmdt', 'id': 4904985, 'node_id': 'MDQ6VXNlcjQ5MDQ5ODU=', 'avatar_url': 'https://avatars.githubusercontent.com/u/4904985?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/mxschmdt', 'html_url': 'https://github.com/mxschmdt', 'followers_url': 'https://api.github.com/users/mxschmdt/followers', 'following_url': 'https://api.github.com/users/mxschmdt/following{/other_user}', 'gists_url': 'https://api.github.com/users/mxschmdt/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/mxschmdt/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/mxschmdt/subscriptions', 'organizations_url': 'https://api.github.com/users/mxschmdt/orgs', 'repos_url': 'https://api.github.com/users/mxschmdt/repos', 'events_url': 'https://api.github.com/users/mxschmdt/events{/privacy}', 'received_events_url': 'https://api.github.com/users/mxschmdt/received_events', 'type': 'User', 'site_admin': False}
[{'id': 1935892857, 'node_id': 'MDU6TGFiZWwxOTM1ODkyODU3', 'url': 'https://api.github.com/repos/huggingface/datasets/labels/bug', 'name': 'bug', 'color': 'd73a4a', 'default': True, 'description': "Something isn't working"}]
[]
Hi! It seems like `flatten_indices` (called in `unique`) doesn't know how to handle empty indices mappings. I'm working on the fix. Thanks, that was fast!
## Describe the bug
After filtering a dataset, and if no samples remain, `Dataset.unique` will return the unique values of the unfiltered dataset.

## Steps to reproduce the bug
```python
from datasets import Dataset

dataset = Dataset.from_dict({'id': [0]})
dataset = dataset.filter(lambda _: False)
print(dataset.unique('id'))
```

## Expected results
The above code should return an empty list since the dataset is empty.

## Actual results
```bash
[0]
```

## Environment info
- `datasets` version: 2.5.1
- Platform: Linux-5.18.19-100.fc35.x86_64-x86_64-with-glibc2.34
- Python version: 3.9.14
- PyArrow version: 7.0.0
- Pandas version: 1.3.5
{'url': 'https://api.github.com/repos/huggingface/datasets/issues/5038/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}