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] Fail to read_json from GzipFile #10590

Closed
grapland0 opened this issue Apr 5, 2022 · 2 comments · Fixed by #12085
Closed

[BUG] Fail to read_json from GzipFile #10590

grapland0 opened this issue Apr 5, 2022 · 2 comments · Fixed by #12085
Assignees
Labels
bug Something isn't working cuIO cuIO issue Python Affects Python cuDF API.

Comments

@grapland0
Copy link

Example:

import gzip
import cudf
import pandas

df = cudf
#df = pandas

x = df.Series([1.0, 2.0, 3.0])

with gzip.open("x.json.gz", mode='wb') as fo:
    x.to_json(fo, orient="table", date_format='iso')

with gzip.open("x.json.gz", mode='rb') as fo:
    y = df.read_json(fo, orient="table")

print(y)

Expected: print a data frame.
Actual:

Traceback (most recent call last):
  File "/workspaces/moana-cxx/tt.py", line 14, in <module>
    y = df.read_json(fo, orient="table")
  File "/root/miniforge3/envs/moana/lib/python3.8/site-packages/cudf/io/json.py", line 75, in read_json
    path_or_buf, compression = ioutils.get_filepath_or_buffer(
  File "/root/miniforge3/envs/moana/lib/python3.8/site-packages/cudf/utils/ioutils.py", line 1291, in get_filepath_or_buffer
    _fsspec_data_transfer(
  File "/root/miniforge3/envs/moana/lib/python3.8/site-packages/cudf/utils/ioutils.py", line 1545, in _fsspec_data_transfer
    file_size = path_or_fob.size
AttributeError: 'GzipFile' object has no attribute 'size'
@grapland0 grapland0 added Needs Triage Need team to review and classify bug Something isn't working labels Apr 5, 2022
@github-actions
Copy link

github-actions bot commented May 5, 2022

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

@GregoryKimball GregoryKimball added cuIO cuIO issue and removed Needs Triage Need team to review and classify labels Jun 28, 2022
@github-actions
Copy link

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

@vuule vuule added the Python Affects Python cuDF API. label Sep 27, 2022
rapids-bot bot pushed a commit that referenced this issue Nov 9, 2022
Fixes: #10590 

This PR fixes an issue where the file-like object doesn't have a `size` attribute, we will manually compute the size of the file.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - https://github.com/brandon-b-miller
  - Vukasin Milovanovic (https://github.com/vuule)

URL: #12085
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 Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants