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] cudf.read_json does not raise an exception with invalid data when lines=True and engine='cudf' #15820

Open
dagardner-nv opened this issue May 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dagardner-nv
Copy link
Contributor

Describe the bug
cudf.read_json doesn't raise an exception when parsing invalid json when lines=True and engine='cudf'. Instead it returns a single row DF with an empty string value.

Setting lines=False raises a RuntimeError (should be a ValueError).
Alternately setting engine='pandas' raises a ValueError.

Steps/Code to reproduce bug

from io import StringIO

import cudf

print(cudf.__version__)
invalid_payload = '{"not_valid":"json'

# Produces a single row DF
print("Testing lines=True, engine=cudf")
print(cudf.read_json(StringIO(invalid_payload), lines=True, engine='cudf'))


# Works as expected
print("Testing lines=False, engine=cudf")
try: 
    cudf.read_json(StringIO(invalid_payload), lines=False, engine='cudf')
except Exception as e:
    print(e)

# Works as expected
print("Testing lines=True, engine=pandas")
try:
    cudf.read_json(StringIO(invalid_payload), lines=True, engine='pandas')
except Exception as e:
    print(e)

Expected behavior
A raised ValueError, although any exception is better than

Environment overview (please complete the following information)

  • Environment location: [Bare-metal]
  • Method of cuDF install: [conda]

Observed in versions 24.04.01 and 24.02.02

@dagardner-nv dagardner-nv added the bug Something isn't working label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

1 participant