Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] dask-cudf fails to read ORC files created by Spark #8011

Closed
randerzander opened this issue Apr 20, 2021 · 1 comment · Fixed by #8021
Closed

[BUG] dask-cudf fails to read ORC files created by Spark #8011

randerzander opened this issue Apr 20, 2021 · 1 comment · Fixed by #8021
Assignees
Labels
bug Something isn't working cuIO cuIO issue dask Dask issue

Comments

@randerzander
Copy link
Contributor

randerzander commented Apr 20, 2021

I'm trying to use dask-cudf to read ORC files generated by a Spark job.

from pyspark.sql import SparkSession
spark = SparkSession \
    .builder \
    .getOrCreate()

df = spark.createDataFrame(
    [
        (1, 1.0),
        (2, 2.0),
    ],
    ['id', 'doubleCol']
)
df.write.mode('overwrite').orc('test')

The above snippet results in 4 files in test:

ls test
part-00000-ddf3787b-958c-4c57-9968-f3afdec1eb7e-c000.snappy.orc  part-00079-ddf3787b-958c-4c57-9968-f3afdec1eb7e-c000.snappy.orc
part-00039-ddf3787b-958c-4c57-9968-f3afdec1eb7e-c000.snappy.orc  _SUCCESS
import dask_cudf

dask_cudf.read_orc('test/*.orc')

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-4-74c488c779a0> in <module>
      1 import dask_cudf
      2 
----> 3 dask_cudf.read_orc('test/*.orc')

~/conda/envs/rapids/lib/python3.8/site-packages/dask_cudf/io/orc.py in read_orc(path, columns, filters, storage_options, **kwargs)
     86 
     87     with fs.open(paths[0], "rb") as f:
---> 88         meta = cudf.read_orc(f, stripes=[0], columns=columns, **kwargs)
     89 
     90     name = "read-orc-" + tokenize(fs_token, path, columns, **kwargs)

~/conda/envs/rapids/lib/python3.8/site-packages/cudf/io/orc.py in read_orc(filepath_or_buffer, engine, columns, filters, stripes, skiprows, num_rows, use_index, timestamp_type, **kwargs)
    258     if engine == "cudf":
    259         df = DataFrame._from_table(
--> 260             liborc.read_orc(
    261                 filepath_or_buffer,
    262                 columns,

cudf/_lib/orc.pyx in cudf._lib.orc.read_orc()

cudf/_lib/orc.pyx in cudf._lib.orc.read_orc()

RuntimeError: cuDF failure at: ../src/io/orc/orc.cpp:478: Invalid stripe index

The ORC files in test can all be read individually by cudf.read_orc. Note that some of the files have 0 rows. It seems like dask-cudf is failing when attempting to read an empty ORC file.

This does not happen with Parquet files.

@randerzander randerzander added bug Something isn't working dask Dask issue cuIO cuIO issue labels Apr 20, 2021
@rjzamora
Copy link
Member

Thanks for raising this @randerzander - Looks like dask_cudf may failing to generate metadata from an empty file. I should be able to look into this tomorrow :)

rapids-bot bot pushed a commit that referenced this issue Apr 22, 2021
Closes #8011 

Dask-cuDF currently reads a single stripe to infer metadata in `read_orc`.  When the first path corresponds to an empty file, there is no stripe "0" to read.  This PR includes a simple fix (and test coverage).

Authors:
  - Richard (Rick) Zamora (https://github.com/rjzamora)

Approvers:
  - Keith Kraus (https://github.com/kkraus14)

URL: #8021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuIO cuIO issue dask Dask issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants