Skip to content

Can't read *.parquet with new parquet code #5153

Closed

Description

@birdsarah

my code

df = dd.read_parquet(
    's3://' + bucket_name + '/*.parquet', 
    engine='fastparquet',
    gather_statistics=False
)
df.head()

error i got

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-24-03f5a773c126> in <module>
      2     's3://' + my_bucket_path + '/*.parquet',
      3     engine='fastparquet',
----> 4     gather_statistics=False
      5 )
      6 df.head()

/mnt/miniconda/envs/jestr-etl/lib/python3.7/site-packages/dask/dataframe/io/parquet/core.py in read_parquet(path, columns, filters, categories, index, storage_options, engine, gather_statistics, **kwargs)
    153         gather_statistics=gather_statistics,
    154         filters=filters,
--> 155         **kwargs
    156     )
    157     if meta.index.name is not None:

/mnt/miniconda/envs/jestr-etl/lib/python3.7/site-packages/dask/dataframe/io/parquet/fastparquet.py in read_metadata(fs, paths, categories, index, gather_statistics, filters, **kwargs)
     98                 pf.file_scheme = scheme
     99                 pf.cats = _paths_to_cats(fns, scheme)
--> 100                 relpath = paths.replace(base, "").lstrip("/")
    101                 for rg in pf.row_groups:
    102                     rg.cats = pf.cats

AttributeError: 'list' object has no attribute 'replace'

Activity

  1. birdsarah commented on Jul 25, 2019

    @birdsarah
    ContributorAuthor

    paths is the correct list of all my paths referenced by 's3://' + my_bucket_path + '/*.parquet'

  2. birdsarah commented on Jul 25, 2019

    @birdsarah
    ContributorAuthor
  3. rjzamora commented on Jul 25, 2019

    @rjzamora
    Member

    This looks like a bug for the case where the fastparquet engine is given a list of files, and gather_statistics=False - I'll fix the relpath definition. Thanks for raising this issue @birdsarah!

  4. rjzamora commented on Jul 25, 2019

    @rjzamora
    Member

    @martindurant @mrocklin - This issue exposes a slight limitation with the current core-engine implementation. The problem is in this untested block of code, which was (incorrectly) borrowed from the original design.

    In the case that gather_statistics=False, we choose not to call pf = ParquetFile(...). However, without scanning the metadata for every file, we cannot populate a list of row-group information to ultimately pass along to read_partition.

    It looks like we need to allow the parts output of read_metadata to specify file-path information (rather than a row-group information) in the case that gather_statistics=False. From there, read_partition can just read a specific file, rather than a specific row group.

  5. birdsarah commented on Aug 22, 2019

    @birdsarah
    ContributorAuthor

    closed by #5157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions