Skip to content

feat: support block gzip for streams - #9175

Merged
alamb merged 3 commits into
apache:mainfrom
tshauck:add-multiple-to-streaming-gzip
Feb 14, 2024
Merged

alamb merged 3 commits into
apache:mainfrom
tshauck:add-multiple-to-streaming-gzip

Conversation

@tshauck

@tshauck tshauck commented Feb 9, 2024

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #9156

Rationale for this change

Updates the stream gzip decoding to check for multiple members within a file.

What changes are included in this PR?

Doesn't update the Read decoder because it already supports multiple members in a file.

Are these changes tested?

The gzip decoding still seems to work, and I checked a manually bgzipped file, but I'm not sure if this code path is tested already.

Are there any user-facing changes?

No

@github-actions github-actions Bot added the core Core DataFusion crate label Feb 9, 2024
@tshauck tshauck mentioned this pull request Feb 9, 2024
@tshauck
tshauck marked this pull request as ready for review February 9, 2024 05:48

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tshauck -- this code looks great to me.

I do think this PR needs a test otherwise we could potentially end up breaking this feature by accident

here some the existing coverage

https://github.com/search?q=repo%3Aapache%2Farrow-datafusion%20aggregate_test_100.csv.gz&type=code

Which I think is referencing this file https://github.com/apache/arrow-testing/blob/master/data/csv/aggregate_test_100.csv.gz

Perhaps you can check in a small .bgzip'd file in https://github.com/apache/arrow-datafusion/tree/main/datafusion/core/tests/data and then add a small test to https://github.com/apache/arrow-datafusion/blob/main/datafusion/sqllogictest/test_files/csv_files.slt ?

@tshauck

tshauck commented Feb 10, 2024

Copy link
Copy Markdown
Contributor Author

Thanks @alamb -- certainly down to add a test. Before I go the route you mentioned, I wanted to ask if you knew that would follow the stream decoding path? Looking at https://github.com/apache/arrow-datafusion/blob/ae882356171513c9d6c22b3bd966898fb4e8cac0/datafusion/core/src/datasource/physical_plan/csv.rs#L393-L441 in the CsvOpener, I think local files would result in .convert_read being called and not .convert_stream which is what is modified in this PR? Is that right?

If not I'll code that up, otherwise perhaps adding a specific unittest that calls .convert_stream or maybe there's a way to force .convert_stream to be called from the slt-based tests? Thanks!

@alamb

alamb commented Feb 11, 2024

Copy link
Copy Markdown
Contributor

If not I'll code that up, otherwise perhaps adding a specific unittest that calls .convert_stream or maybe there's a way to force .convert_stream to be called from the slt-based tests? Thanks!

I think a specific unit test for convert stream would be great and easiest (and you can probably just generate some data directly)

@tshauck

tshauck commented Feb 13, 2024

Copy link
Copy Markdown
Contributor Author

I think this is ready for review @alamb.

Happy to take another approach testing, but in 4e009e1 I added the test which creates a byte stream from a hardcoded vector.

@tshauck
tshauck requested a review from alamb February 13, 2024 22:41

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me -- thank you @tshauck

@tshauck

tshauck commented Feb 14, 2024

Copy link
Copy Markdown
Contributor Author

Thanks!

@alamb
alamb merged commit 0c46d7f into apache:main Feb 14, 2024
@tshauck
tshauck deleted the add-multiple-to-streaming-gzip branch February 14, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple_members on compression decoders?

2 participants