You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deprecate "pyarrow-legacy" engine in dask.dataframe.read_parquet #8243
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.
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.
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.
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
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)
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:
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).
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.
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.
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).
Activity
jrbourbeau commentedon Oct 8, 2021
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-legacyengine will still be able to be read in using thepyarrow-datasetengine.cc @jorisvandenbossche @martindurant
martindurant commentedon Oct 9, 2021
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.
jorisvandenbossche commentedon Oct 22, 2021
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.ParquetDatasethas ametadataparameter 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_groupskeyword: also already handled already by dask itselfmetadata_nthreadskeyword: 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-8137validate_schemakeyword: 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).schemakeyword, 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 aschemakeyword 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)jorisvandenbossche commentedon Oct 22, 2021
It seems currently no additional keywords are allowed to be passed through to the
pyarrow.datasetconstructor:dask/dask/dataframe/io/parquet/arrow.py
Lines 780 to 782 in ac01ddc
That's of course a separate question from the deprecation in this issue, but it might be useful to relax the above.
rjzamora commentedon Feb 25, 2022
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).
jorisvandenbossche commentedon Apr 4, 2022
Small note: there is still some remaining
pq.ParquetDatasetPieceusage, and that class is also deprecated.martindurant commentedon Apr 4, 2022
@jorisvandenbossche , does this mean that all usage of pyarrow.parquet should now be avoided?
cc @jpivarski
jorisvandenbossche commentedon Apr 4, 2022
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(withuse_legacy_dataset=False, which will become the default), etc are all not going away.jpivarski commentedon Apr 4, 2022
I've had to use
pyarrow.parquet.ParquetFilein 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,ParquetFileis 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.
rjzamora commentedon Apr 5, 2022
Good point, and thanks for raising this concern! It looks like the remaining use of
ParquetDatasetPiecemay 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).jorisvandenbossche commentedon Apr 6, 2022
Also the
PartitionObjcould 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).