Skip to content

Deprecate "pyarrow-legacy" engine in dask.dataframe.read_parquet #8243

Closed

Description

@rjzamora

Given the pyarrow version requirements in Dask, we can now assume the dataset API will be supported if pyarrow is installed. We can also assume that deprecation warnings will be raised by the pyarrow backend if dd.read_parquet(..., engine="pyarrow-legacy") is used. Therefore, I propose that we add an explicit deprecation warning for the "pyarrow-legacy" engine itself, and establish a timeline for its removal.

Deprecating and removing "pyarrow-legacy" should simplifyread_parquet maintenance, and should have few (if any) downsides. However, I welcome pushback if others expect this to cause pain or problems.

Activity

  1. jrbourbeau commented on Oct 8, 2021

    @jrbourbeau
    Member

    Thanks @rjzamora. This makes total sense from a maintenance perspective. What impact will this have on users? IIUC existing Parquet files that were written with the pyarrow-legacy engine will still be able to be read in using the pyarrow-dataset engine.

    cc @jorisvandenbossche @martindurant

  2. martindurant commented on Oct 9, 2021

    @martindurant
    Member

    I would be surprised if there were still options/features available with the legacy backend not covered by dataset. I am not the expert on that, though.

  3. jorisvandenbossche commented on Oct 22, 2021

    @jorisvandenbossche
    Member

    There are still some options that the dataset reader does not yet support compared to the plain ParquetFile reader / the ParquetDataset constructor with use_legacy_dataset=True, but I suspect those are not of relevance for (most) dask users.

    • The legacy ParquetDataset has a metadata parameter for if you had obtained Parquet FileMetaData yourself (I suppose typically used when having a metadata-only file, but that use case is already covered by dask itself).
    • split_row_groups keyword: also already handled already by dask itself
    • metadata_nthreads keyword: to discover the files of the dataset multithreaded. This would be potentially useful for dask I suppose if this happens on the client side to construct the graph (xref issue #8058), but something that could also be implemented for the new datasets interface. JIRA for this: https://issues.apache.org/jira/browse/ARROW-8137
    • validate_schema keyword: in dask, you set this to False by default (if not specified by the user) to override the default of ParquetDataset. That corresponds to the default of the new dataset API (which will by default not check all files of a dataset in advance, but error on runtime in case of non-matching schemas).
    • schema keyword, but in the legacy interface this is a Parquet schema, and not arrow schema, so that's not something you can construct yourself (and so I doubt many people are using this). In the new dataset interface, there is also a schema keyword which might be more useful, though (it's an arrow schema, and with this you can force to use a certain schema on how to read all the files)
  4. jorisvandenbossche commented on Oct 22, 2021

    @jorisvandenbossche
    Member

    In the new dataset interface, there is also a schema keyword which might be more useful, though (it's an arrow schema, and with this you can force to use a certain schema on how to read all the files)

    It seems currently no additional keywords are allowed to be passed through to the pyarrow.dataset constructor:

    # Check that we are not silently ignoring any dataset_kwargs
    if _dataset_kwargs:
    raise ValueError(f"Unsupported dataset_kwargs: {_dataset_kwargs.keys()}")

    That's of course a separate question from the deprecation in this issue, but it might be useful to relax the above.

  5. added
    needs attention
    on Nov 22, 2021
  6. rjzamora commented on Feb 25, 2022

    @rjzamora
    MemberAuthor

    Thanks for the excellent summary @jorisvandenbossche (Sorry for the delay - I know it was a while back). #8758 is taking the first step at addressing this issue (adding a deprecation warning).

  7. jorisvandenbossche commented on Apr 4, 2022

    @jorisvandenbossche
    Member

    Small note: there is still some remaining pq.ParquetDatasetPiece usage, and that class is also deprecated.

  8. martindurant commented on Apr 4, 2022

    @martindurant
    Member

    @jorisvandenbossche , does this mean that all usage of pyarrow.parquet should now be avoided?

    cc @jpivarski

  9. jorisvandenbossche commented on Apr 4, 2022

    @jorisvandenbossche
    Member

    No, only the deprecated classes / attributes (which includes ParquetDataset() with use_legacy_dataset=True (which gives you the pieces/partitions attributes) and ParquetDatasetPiece).
    But eg ParquetFile, read_table, write_table, ParquetDataset (with use_legacy_dataset=False, which will become the default), etc are all not going away.

  10. jpivarski commented on Apr 4, 2022

    @jpivarski

    cc @jpivarski

    I've had to use pyarrow.parquet.ParquetFile in a new function (here) because the Dataset API has no way to specify nested columns (i.e. fields of Structs nested within an object, not the top-level Table fields). See scikit-hep/awkward#1338 (comment). In general, ParquetFile is a more powerful, though lower-level, reader than the Dataset API.

    None of that matters for reading DataFrames, which is what I gather this PR is about. The Dataset API seems to have been designed with DataFrames in mind (the top-level columns are qualitatively different from nested columns).

    I think the reason @martindurant was asking is because the function I'm referring to is to be used by dask-awkward to read Parquet in Daskified Awkward Array collections, so it would be new code using it (transitively) in a Dask project.

    But I just got your update, @jorisvandenbossche, so it sounds like we have nothing to worry about.

  11. rjzamora commented on Apr 5, 2022

    @rjzamora
    MemberAuthor

    Small note: there is still some remaining pq.ParquetDatasetPiece usage, and that class is also deprecated.

    Good point, and thanks for raising this concern! It looks like the remaining use of ParquetDatasetPiece may just be "stale" code that is no longer used or tested. I will certainly want to confirm this and remove the unnecessary brach (or clean things up further).

  12. jorisvandenbossche commented on Apr 6, 2022

    @jorisvandenbossche
    Member

    Also the PartitionObj could be cleaned up (or at least its docstring; it might be that it's still a useful abstraction for only the new code as well).

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

Metadata

Metadata

Assignees

Labels

dataframeioneeds attentionparquet

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions