Support reading of ZSTD files, and add support for writing GZIP and ZSTD files #2697
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements #2538
This PR implements the
ZStdFileSystem
(as part of the Parquet extension, since the ZSTD library is shipped as part of the Parquet extension). This allows DuckDB to read ZSTD compressed CSV files in a streaming manner. By default the compression type will be automatically inferred from the file extension. The compression type can also be provided as a parameter to theCOPY
statement and theread_csv
function.This PR cleans up the GZipFileSystem by adding an underlying CompressedFileSystem that is used by both the GZip and ZStd file systems. This should also make it easier to add support for other compression formats in the future.
ZSTD/GZIP Writing
In addition to enabling reading support of ZSTD files, this PR also adds support for writing files compressed in both ZSTD and GZIP formats, e.g.:
Just like regular CSV files, compressed CSV files are written in a streaming manner, meaning the full data set does not need to fit in memory for the write.