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
Dask fails to read hand-partitioned Parquet dataset from S3 source #6713
This organization follows the Parquet dataset partitioning convention used by Hive Metastore. This partitioning scheme was generated by hand, so there is no _metadata file anywhere in the directory tree.
I would like to now read this dataset into Dask.
With data located on local disk, the following code works:
import dask.dataframe as dd
dd.read_parquet(
"/Users/alekseybilogur/Desktop/2019-taxi-trips/*/data.parquet",
engine="fastparquet"
)
I copied these files to an S3 bucket (via s3 sync; partition folders are top level keys in the bucket, like so), and attempted to read them off of cloud storage using the same basic function:
Note that I expect the following workaround to work:
use s3fs to glob the path "2019-nyc-taxi-trips/*/data.parquet"
pass this list of paths (with "s3://" prefix) to read_parquet.
Probably fastparquet itself ought to be aware of glob strings, but its API predates fsspec, and it expects only the open function of the filesystem, not the filesystem itself.
@ResidentMario, @martindurant on a related note, support for parquet filters that understand parquet dataset partitioning is very useful. In situations where there are large number of parquet files, s3fs globs can be a big bottleneck. The pyarrow backend supports this pretty well. I've been able to read datasets as follows:
@hhuuggoo this is an unrelated question, but for my own knowledge. I also attempted to read these files using pyarrow, using pretty much the same code sample you show here, and was blocked on a "pyarrow not compiled with S3 support" error message.
How did you get a version of pyarrow that supports S3? Did you compile pyarrow yourself?
pyarrow should not need s3 support internally, as dask passes an s3fs file system object to it. Can you specify what you have installed on your system and how you got to that error?
@hhuuggoo this is an unrelated question, but for my own knowledge. I also attempted to read these files using pyarrow, using pretty much the same code sample you show here, and was blocked on a "pyarrow not compiled with S3 support" error message.
How did you get a version of pyarrow that supports S3? Did you compile pyarrow yourself?
I'm pretty sure I'm just using the pyarrow conda package, so nothing special on my end
In the latter you are asking pyarrow to create its own filesystem type, and it doesn't know about fsspec directly. You can pass the (s3fs) filesystem object to ds.dataset, which is what Dask does internally.
Late answer here, but indeed pyarrow itself doesn't use or fallback to fsspec, and by default only uses its own filesystems (unless you pass it explicitly a filesystem object, like @martindurant showed).
Pyarrow includes an S3 filesystem implementation, but, the support for this in the wheels is a bit varying (AFAIK, wheels for windows lack support for this, and for Mac OSX support was only added in the wheels for the 2.0 release; conda packages for all platforms and linux wheels should be fine). So I suppose that is the reason you saw that error message ("Got S3 URI but Arrow compiled without S3 support"), which by itself is thus correct, but I certainly understand that this is confusing if you don't know the broader picture..
Well, to be honest, this isn't my first attempt to use pyarrow for something, and not my first time running into an opaque (to me) issue like this getting in the way. I'm sure it's a very powerful tool if you know how to use it but...
Activity
martindurant commentedon Oct 8, 2020
Note that I expect the following workaround to work:
s3fsto glob the path "2019-nyc-taxi-trips/*/data.parquet"Probably
fastparquetitself ought to be aware of glob strings, but its API predatesfsspec, and it expects only theopenfunction of the filesystem, not the filesystem itself.hhuuggoo commentedon Oct 9, 2020
@ResidentMario, @martindurant on a related note, support for parquet filters that understand parquet dataset partitioning is very useful. In situations where there are large number of parquet files, s3fs globs can be a big bottleneck. The pyarrow backend supports this pretty well. I've been able to read datasets as follows:
ResidentMario commentedon Oct 9, 2020
@hhuuggoo this is an unrelated question, but for my own knowledge. I also attempted to read these files using
pyarrow, using pretty much the same code sample you show here, and was blocked on a "pyarrownot compiled with S3 support" error message.How did you get a version of
pyarrowthat supports S3? Did you compilepyarrowyourself?martindurant commentedon Oct 9, 2020
pyarrow should not need s3 support internally, as dask passes an s3fs file system object to it. Can you specify what you have installed on your system and how you got to that error?
hhuuggoo commentedon Oct 9, 2020
I'm pretty sure I'm just using the pyarrow conda package, so nothing special on my end
martindurant commentedon Oct 9, 2020
@jorisvandenbossche , have people been seeing this? Perhaps with the arrow filesystem migration?
ResidentMario commentedon Oct 9, 2020
@martindurant You are correct. The following code sample works:
The following code sample, which uses the
pyarrowdirectly, fails:It is not transparent to me why one would work and the other would fail. ¯\_(ツ)_/¯
martindurant commentedon Oct 9, 2020
In the latter you are asking pyarrow to create its own filesystem type, and it doesn't know about fsspec directly. You can pass the (s3fs) filesystem object to
ds.dataset, which is what Dask does internally.ResidentMario commentedon Oct 9, 2020
Oh interesting! So the error message is merely a bit misleading/ambiguous then, got it, ty ty.
martindurant commentedon Oct 9, 2020
I wouldn't call it ambiguous or misleading, but perhaps incomplete :)
jorisvandenbossche commentedon Nov 23, 2020
Late answer here, but indeed
pyarrowitself doesn't use or fallback tofsspec, and by default only uses its own filesystems (unless you pass it explicitly a filesystem object, like @martindurant showed).Pyarrow includes an S3 filesystem implementation, but, the support for this in the wheels is a bit varying (AFAIK, wheels for windows lack support for this, and for Mac OSX support was only added in the wheels for the 2.0 release; conda packages for all platforms and linux wheels should be fine). So I suppose that is the reason you saw that error message ("Got S3 URI but Arrow compiled without S3 support"), which by itself is thus correct, but I certainly understand that this is confusing if you don't know the broader picture..
ResidentMario commentedon Nov 23, 2020
Well, to be honest, this isn't my first attempt to use
pyarrowfor something, and not my first time running into an opaque (to me) issue like this getting in the way. I'm sure it's a very powerful tool if you know how to use it but...