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

Parallel read for json compressed files when it should not #9564

Closed
yongda-fan opened this issue Mar 12, 2024 · 3 comments · Fixed by #9799
Closed

Parallel read for json compressed files when it should not #9564

yongda-fan opened this issue Mar 12, 2024 · 3 comments · Fixed by #9799
Assignees
Labels
bug Something isn't working

Comments

@yongda-fan
Copy link

Describe the bug

When reading a compressed json file, with repartition_file_scans = true (default value), datafusion try to uncompress the file with parallel read. This will cause ArrowError(IoError("invalid gzip header", Custom { kind: InvalidInput, error: "invalid gzip header" }), None) because there is no gzip header in the middle.

To Reproduce

let df = ctx.read_json(
        "C:/path/to/file.gz", 
        NdJsonReadOptions::default()
        .file_compression_type(FileCompressionType::GZIP)
        .file_extension("gz")
        .schema(&s3_user_schema())
    ).await.unwrap();

Expected behavior

the data should read correctly without errors

Additional context

by put a print statement before the JsonOpener, we can see

GetResult { payload: GetResultPayload(File), meta: ObjectMeta { location: Path { raw: "C:/some/path/foo.gz" }, last_modified: 2024-03-06T00:01:02Z, size: 149873338, e_tag: Some("0-612f2a7828b80-8eee2ba"), version: None }, range: 0..4685075 }
GetResult { payload: GetResultPayload(File), meta: ObjectMeta { location: Path { raw: "C:/some/path/foo.gz" }, last_modified: 2024-03-06T00:01:02Z, size: 149873338, e_tag: Some("0-612f2a7828b80-8eee2ba"), version: None }, range: 37468620..42151887 }
GetResult { payload: GetResultPayload(File), meta: ObjectMeta { location: Path { raw: "C:/some/path/foo.gz" }, last_modified: 2024-03-06T00:01:02Z, size: 149873338, e_tag: Some("0-6.......

which suggest it's indeed reading a compressed json file in parallel.

@yongda-fan yongda-fan added the bug Something isn't working label Mar 12, 2024
@Lordworms
Copy link
Contributor

take

@Lordworms
Copy link
Contributor

Could you provide more information about the file and the schema? Since I tried a simple gzip file and it work out fine

@alamb
Copy link
Contributor

alamb commented Mar 24, 2024

I agree it is not possible to repartition a json compressed file -- so when the file is compressed we should not repartition

You can probably reproduce this issue with a single json file (maybe repeat the same record over and over again), gzip it, and then try to read it in

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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants