Unable to create a dataset from a parquet file in S3
Opened by regCode (open)

## Describe the bug
Trying to create a dataset from a parquet file in S3.

## Steps to reproduce the bug
```python
import s3fs
from datasets import Dataset

s3 = s3fs.S3FileSystem(anon=False)

with s3.open(PATH_LTR_TOY_CLEAN_DATASET, 'rb') as s3file:
    dataset = Dataset.from_parquet(s3file)
```

## Expected results
A new Dataset object

## Actual results

```AttributeError: 'S3File' object has no attribute 'decode'```
```
AttributeError                            Traceback (most recent call last)
<command-2452877612515691> in <module>
      5 
      6 with s3.open(PATH_LTR_TOY_CLEAN_DATASET, 'rb') as s3file:
----> 7     dataset = Dataset.from_parquet(s3file)

/databricks/python/lib/python3.8/site-packages/datasets/arrow_dataset.py in from_parquet(path_or_paths, split, features, cache_dir, keep_in_memory, columns, **kwargs)
    907         from .io.parquet import ParquetDatasetReader
    908 
--> 909         return ParquetDatasetReader(
    910             path_or_paths,
    911             split=split,

/databricks/python/lib/python3.8/site-packages/datasets/io/parquet.py in __init__(self, path_or_paths, split, features, cache_dir, keep_in_memory, **kwargs)
     28         path_or_paths = path_or_paths if isinstance(path_or_paths, dict) else {self.split: path_or_paths}
     29         hash = _PACKAGED_DATASETS_MODULES["parquet"][1]
---> 30         self.builder = Parquet(
     31             cache_dir=cache_dir,
     32             data_files=path_or_paths,

/databricks/python/lib/python3.8/site-packages/datasets/builder.py in __init__(self, cache_dir, name, hash, base_path, info, features, use_auth_token, namespace, data_files, data_dir, **config_kwargs)
    246 
    247         if data_files is not None and not isinstance(data_files, DataFilesDict):
--> 248             data_files = DataFilesDict.from_local_or_remote(
    249                 sanitize_patterns(data_files), base_path=base_path, use_auth_token=use_auth_token
    250             )

/databricks/python/lib/python3.8/site-packages/datasets/data_files.py in from_local_or_remote(cls, patterns, base_path, allowed_extensions, use_auth_token)
    576         for key, patterns_for_key in patterns.items():
    577             out[key] = (
--> 578                 DataFilesList.from_local_or_remote(
    579                     patterns_for_key,
    580                     base_path=base_path,

/databricks/python/lib/python3.8/site-packages/datasets/data_files.py in from_local_or_remote(cls, patterns, base_path, allowed_extensions, use_auth_token)
    544     ) -> "DataFilesList":
    545         base_path = base_path if base_path is not None else str(Path().resolve())
--> 546         data_files = resolve_patterns_locally_or_by_urls(base_path, patterns, allowed_extensions)
    547         origin_metadata = _get_origin_metadata_locally_or_by_urls(data_files, use_auth_token=use_auth_token)
    548         return cls(data_files, origin_metadata)

/databricks/python/lib/python3.8/site-packages/datasets/data_files.py in resolve_patterns_locally_or_by_urls(base_path, patterns, allowed_extensions)
    191     data_files = []
    192     for pattern in patterns:
--> 193         if is_remote_url(pattern):
    194             data_files.append(Url(pattern))
    195         else:

/databricks/python/lib/python3.8/site-packages/datasets/utils/file_utils.py in is_remote_url(url_or_filename)
    115 
    116 def is_remote_url(url_or_filename: str) -> bool:
--> 117     parsed = urlparse(url_or_filename)
    118     return parsed.scheme in ("http", "https", "s3", "gs", "hdfs", "ftp")
    119 

/usr/lib/python3.8/urllib/parse.py in urlparse(url, scheme, allow_fragments)
    370     Note that we don't break the components up in smaller bits
    371     (e.g. netloc is a single string) and we don't expand % escapes."""
--> 372     url, scheme, _coerce_result = _coerce_args(url, scheme)
    373     splitresult = urlsplit(url, scheme, allow_fragments)
    374     scheme, netloc, url, query, fragment = splitresult

/usr/lib/python3.8/urllib/parse.py in _coerce_args(*args)
    122     if str_input:
    123         return args + (_noop,)
--> 124     return _decode_args(args) + (_encode_result,)
    125 
    126 # Result objects are more helpful than simple tuples

/usr/lib/python3.8/urllib/parse.py in _decode_args(args, encoding, errors)
    106 def _decode_args(args, encoding=_implicit_encoding,
    107                        errors=_implicit_errors):
--> 108     return tuple(x.decode(encoding, errors) if x else '' for x in args)
    109 
    110 def _coerce_args(*args):

/usr/lib/python3.8/urllib/parse.py in <genexpr>(.0)
    106 def _decode_args(args, encoding=_implicit_encoding,
    107                        errors=_implicit_errors):
--> 108     return tuple(x.decode(encoding, errors) if x else '' for x in args)
    109 
    110 def _coerce_args(*args):

AttributeError: 'S3File' object has no attribute 'decode'
```

## Environment info
<!-- You can run the command `datasets-cli env` and copy-and-paste its output below. -->
- `datasets` version: 1.17.0
- Platform: Ubuntu 20.04.3 LTS
- Python version: 3.8.10
- PyArrow version: 6.0.1


Comments:
Hi ! Currently it only works with local paths, file-like objects are not supported yet