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
Custom sort key for dataframe.read_parquet with multiple paths as input #10045
dask.dataframe.read_parquet accepts a list of paths as input. It uses natural_sort_key under the hood to sort the paths in several places. In my case parquet files are not in the natural order and I'd like to sort them outside and keep the same order inside the read_parquet, so I do monkey patching like this to make it work:
does it make sense to use the given file order if users provide a list of paths?
Yes. This has come up before (I’ll need to find the original issue and link later). It may be a bit easier to make it optional to sort a user-provided path list now.
Thanks for explaining @alexgorban! Please feel free to provide feedback on the proposed solution in #10061. The current plan is to simply preserve the order of a user-provided path list, but to use natural sorting when a directory or glob-pattern is specified.
Activity
jrbourbeau commentedon Mar 13, 2023
Thanks for the issue @alexgorban. Out of curiosity, how are your files being produced?
@rjzamora does it make sense to use the given file order if users provide a list of paths?
rjzamora commentedon Mar 13, 2023
Yes. This has come up before (I’ll need to find the original issue and link later). It may be a bit easier to make it optional to sort a user-provided path list now.
alexgorban commentedon Mar 29, 2023
Files are created using Apache Arrow with filenames sorted alphabetically (pyarrow.Table.sort_by doesn't support custom key functions) and have the following format:
{hash}_{a}_{b}_{c}_{d}.parquet, ex.10023947602400723454_1120_000_1140_000. Their order is important because they have a sorted index column and their metadata stored with this order. Full details about the dataset format can be found here https://github.com/waymo-research/waymo-open-dataset/blob/master/tutorial/tutorial_v2.ipynb.Thanks a lot for considering implementing this feature!
rjzamora commentedon Mar 29, 2023
Thanks for explaining @alexgorban! Please feel free to provide feedback on the proposed solution in #10061. The current plan is to simply preserve the order of a user-provided path list, but to use natural sorting when a directory or glob-pattern is specified.