Repository navigation
Closed
Labels
dataframeioneeds attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.parquet
Description
This example requires adlfs and planetary-computer (pip install adlfs planetary-computer)
>>> import dask.dataframe as dd, planetary_computer
>>> credential = planetary_computer.sas.get_token("ai4edataeuwest", "gbif").token
>>> dd.read_parquet('abfs://gbif/occurrence/2021-10-01/occurrence.parquet', storage_options=dict(account_name="ai4edataeuwest", credential=credential))This raises with
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-3665ff1dc1a7> in <module>
1 import dask.dataframe as dd, planetary_computer
2 credential = planetary_computer.sas.get_token("ai4edataeuwest", "gbif").token
----> 3 dd.read_parquet('abfs://gbif/occurrence/2021-10-01/occurrence.parquet', storage_options=dict(account_name="ai4edataeuwest", credential=credential))
~/src/dask/dask/dask/dataframe/io/parquet/core.py in read_parquet(path, columns, filters, categories, index, storage_options, engine, gather_statistics, ignore_metadata_file, metadata_task_size, split_row_groups, chunksize, aggregate_files, **kwargs)
324 gather_statistics = True
325
--> 326 read_metadata_result = engine.read_metadata(
327 fs,
328 paths,
~/src/dask/dask/dask/dataframe/io/parquet/arrow.py in read_metadata(cls, fs, paths, categories, index, gather_statistics, filters, split_row_groups, chunksize, aggregate_files, ignore_metadata_file, metadata_task_size, **kwargs)
328
329 # Stage 1: Collect general dataset information
--> 330 dataset_info = cls._collect_dataset_info(
331 paths,
332 fs,
~/src/dask/dask/dask/dataframe/io/parquet/arrow.py in _collect_dataset_info(cls, paths, fs, categories, index, gather_statistics, filters, split_row_groups, chunksize, aggregate_files, ignore_metadata_file, metadata_task_size, require_extension, **dataset_kwargs)
827 ]
828 if len0 and paths == []:
--> 829 raise ValueError(
830 "No files satisfy the `require_extension` criteria "
831 f"(files must end with {require_extension})."
ValueError: No files satisfy the `require_extension` criteria (files must end with ('.parq', '.parquet')).Related to #8349. Is this a deliberate change and I'll need to update the code? Or is it unintentonal?
In case it helps, here's the directory structure:
In [5]: import adlfs
In [6]: fs = adlfs.AzureBlobFileSystem("ai4edataeuwest", credential=credential)
In [8]: fs.ls("gbif/occurrence/2021-10-01")
Out[8]:
['gbif/occurrence/2021-10-01/citation.txt',
'gbif/occurrence/2021-10-01/occurrence.parquet']
In [9]: fs.ls("gbif/occurrence/2021-10-01/occurrence.parquet")[:10]
Out[9]:
['gbif/occurrence/2021-10-01/occurrence.parquet/000000',
'gbif/occurrence/2021-10-01/occurrence.parquet/000001',
'gbif/occurrence/2021-10-01/occurrence.parquet/000002',
'gbif/occurrence/2021-10-01/occurrence.parquet/000003',
'gbif/occurrence/2021-10-01/occurrence.parquet/000004',
'gbif/occurrence/2021-10-01/occurrence.parquet/000005',
'gbif/occurrence/2021-10-01/occurrence.parquet/000006',
'gbif/occurrence/2021-10-01/occurrence.parquet/000007',
'gbif/occurrence/2021-10-01/occurrence.parquet/000008',
'gbif/occurrence/2021-10-01/occurrence.parquet/000009']
cc @rjzamora.
Metadata
Metadata
Assignees
Labels
dataframeioneeds attentionIt's been a while since this was pushed on. Needs attention from the owner or a maintainer.parquet
Activity
TomAugspurger commentedon Dec 15, 2021
Reading through things a bit more closely, and looking at that file structure, I guess this might be the expected behavior?
I'm not seeing
require_extensiondocumented anywhere. IIUC it's passed through likeread_parquet(..., dataset={"required_extension": None}). I don't seedatasetdocumented either. Is that a pyarrow specific keyword, or can it be added as a top-level keyword argument?rjzamora commentedon Dec 15, 2021
Ah - Right. You will need to disable the required file extensions if you only specify a directory (without a _metadata) file. This behavior was added for Spark compatibility.
I think the lack of
required_extensiondocumentation is a mistake, and the documentation fordataset"exists", but is pretty terrible. Note that #8339 improves the 'dataset' description slightly, but the real problem is that theread=anddataset=parqameters are described underkwargs(which doesn't really makes much sense at all).Perhaps it would be best to add explict
dataset_optionsandread_optionsarguments, with dedicated documentation? (For backward compatibility, we can redirectread/datasetarguments when they are still specified).TomAugspurger commentedon Dec 16, 2021
Thanks. So to confirm, if I added a
_metadatafile then the additional keyword arguments wouldn't be necessary?Yeah, I think that's a great idea. I can take that on if you want, though perhaps #8339 should go in first.
rjzamora commentedon Dec 16, 2021
If you are motivated to do it soon, then don't worry too much about #8339 (I don't mind revising it if needed) :)