`load_dataset` does not work with certain filename.
Opened by whatever60 (closed)

## Describe the bug
This is a weird bug that took me some time to find out.

I have a JSON dataset that I want to load with `load_dataset` like this:

```
data_files = dict(train="train.json.zip", val="val.json.zip")
dataset = load_dataset("json", data_files=data_files, field="data")
```

## Expected results
No error.

## Actual results
The val file is loaded as expected, but the train file throws JSON decoding error:

```
╭──────────────────────────── Traceback (most recent call last) ────────────────────────────╮
│ <ipython-input-74-97947e92c100>:5 in <module>                                             │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/datasets/load.py:1687 in    │
│ load_dataset                                                                              │
│                                                                                           │
│   1684 │   try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES                       │
│   1685 │                                                                                  │
│   1686 │   # Download and prepare data                                                    │
│ ❱ 1687 │   builder_instance.download_and_prepare(                                         │
│   1688 │   │   download_config=download_config,                                           │
│   1689 │   │   download_mode=download_mode,                                               │
│   1690 │   │   ignore_verifications=ignore_verifications,                                 │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/datasets/builder.py:605 in  │
│ download_and_prepare                                                                      │
│                                                                                           │
│    602 │   │   │   │   │   │   except ConnectionError:                                    │
│    603 │   │   │   │   │   │   │   logger.warning("HF google storage unreachable. Downloa │
│    604 │   │   │   │   │   if not downloaded_from_gcs:                                    │
│ ❱  605 │   │   │   │   │   │   self._download_and_prepare(                                │
│    606 │   │   │   │   │   │   │   dl_manager=dl_manager, verify_infos=verify_infos, **do │
│    607 │   │   │   │   │   │   )                                                          │
│    608 │   │   │   │   │   # Sync info                                                    │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/datasets/builder.py:694 in  │
│ _download_and_prepare                                                                     │
│                                                                                           │
│    691 │   │   │                                                                          │
│    692 │   │   │   try:                                                                   │
│    693 │   │   │   │   # Prepare split will record examples associated to the split       │
│ ❱  694 │   │   │   │   self._prepare_split(split_generator, **prepare_split_kwargs)       │
│    695 │   │   │   except OSError as e:                                                   │
│    696 │   │   │   │   raise OSError(                                                     │
│    697 │   │   │   │   │   "Cannot find data file. "                                      │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/datasets/builder.py:1151 in │
│ _prepare_split                                                                            │
│                                                                                           │
│   1148 │   │                                                                              │
│   1149 │   │   generator = self._generate_tables(**split_generator.gen_kwargs)            │
│   1150 │   │   with ArrowWriter(features=self.info.features, path=fpath) as writer:       │
│ ❱ 1151 │   │   │   for key, table in logging.tqdm(                                        │
│   1152 │   │   │   │   generator, unit=" tables", leave=False, disable=True  # not loggin │
│   1153 │   │   │   ):                                                                     │
│   1154 │   │   │   │   writer.write_table(table)                                          │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/tqdm/notebook.py:257 in     │
│ __iter__                                                                                  │
│                                                                                           │
│   254 │                                                                                   │
│   255 │   def __iter__(self):                                                             │
│   256 │   │   try:                                                                        │
│ ❱ 257 │   │   │   for obj in super(tqdm_notebook, self).__iter__():                       │
│   258 │   │   │   │   # return super(tqdm...) will not catch exception                    │
│   259 │   │   │   │   yield obj                                                           │
│   260 │   │   # NB: except ... [ as ...] breaks IPython async KeyboardInterrupt           │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/tqdm/std.py:1183 in         │
│ __iter__                                                                                  │
│                                                                                           │
│   1180 │   │   # If the bar is disabled, then just walk the iterable                      │
│   1181 │   │   # (note: keep this check outside the loop for performance)                 │
│   1182 │   │   if self.disable:                                                           │
│ ❱ 1183 │   │   │   for obj in iterable:                                                   │
│   1184 │   │   │   │   yield obj                                                          │
│   1185 │   │   │   return                                                                 │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/site-packages/datasets/packaged_modules/j │
│ son/json.py:90 in _generate_tables                                                        │
│                                                                                           │
│    87 │   │   │   # If the file is one json object and if we need to look at the list of  │
│    88 │   │   │   if self.config.field is not None:                                       │
│    89 │   │   │   │   with open(file, encoding="utf-8") as f:                             │
│ ❱  90 │   │   │   │   │   dataset = json.load(f)                                          │
│    91 │   │   │   │                                                                       │
│    92 │   │   │   │   # We keep only the field we are interested in                       │
│    93 │   │   │   │   dataset = dataset[self.config.field]                                │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/json/__init__.py:293 in load              │
│                                                                                           │
│   290 │   To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``           │
│   291 │   kwarg; otherwise ``JSONDecoder`` is used.                                       │
│   292 │   """                                                                             │
│ ❱ 293 │   return loads(fp.read(),                                                         │
│   294 │   │   cls=cls, object_hook=object_hook,                                           │
│   295 │   │   parse_float=parse_float, parse_int=parse_int,                               │
│   296 │   │   parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)   │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/json/__init__.py:357 in loads             │
│                                                                                           │
│   354 │   if (cls is None and object_hook is None and                                     │
│   355 │   │   │   parse_int is None and parse_float is None and                           │
│   356 │   │   │   parse_constant is None and object_pairs_hook is None and not kw):       │
│ ❱ 357 │   │   return _default_decoder.decode(s)                                           │
│   358 │   if cls is None:                                                                 │
│   359 │   │   cls = JSONDecoder                                                           │
│   360 │   if object_hook is not None:                                                     │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/json/decoder.py:337 in decode             │
│                                                                                           │
│   334 │   │   containing a JSON document).                                                │
│   335 │   │                                                                               │
│   336 │   │   """                                                                         │
│ ❱ 337 │   │   obj, end = self.raw_decode(s, idx=_w(s, 0).end())                           │
│   338 │   │   end = _w(s, end).end()                                                      │
│   339 │   │   if end != len(s):                                                           │
│   340 │   │   │   raise JSONDecodeError("Extra data", s, end)                             │
│                                                                                           │
│ /home/tiankang/software/anaconda3/lib/python3.8/json/decoder.py:353 in raw_decode         │
│                                                                                           │
│   350 │   │                                                                               │
│   351 │   │   """                                                                         │
│   352 │   │   try:                                                                        │
│ ❱ 353 │   │   │   obj, end = self.scan_once(s, idx)                                       │
│   354 │   │   except StopIteration as err:                                                │
│   355 │   │   │   raise JSONDecodeError("Expecting value", s, err.value) from None        │
│   356 │   │   return obj, end                                                             │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
JSONDecodeError: Unterminated string starting at: line 85 column 20 (char 60051)
```

However, when I rename the `train.json.zip` to other names (like `training.json.zip`, or even to `train.json`), everything works fine; when I unzip the file to `train.json`, it works as well.

## Environment info
```
- `datasets` version: 2.1.0
- Platform: Linux-4.4.0-131-generic-x86_64-with-glibc2.10
- Python version: 3.8.5
- PyArrow version: 7.0.0
- Pandas version: 1.4.2
```

Comments: Never mind. It is because of the caching of datasets...