Skip to content

Commit

Permalink
add parquet compression
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 18, 2021
1 parent f225b3d commit fe00bd7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions polars/polars-io/src/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ where
///
pub struct ParquetWriter<W> {
writer: W,
compression: write::Compression,
}

impl<W> ParquetWriter<W>
Expand All @@ -137,7 +138,16 @@ where
where
W: Write + Seek,
{
ParquetWriter { writer }
ParquetWriter {
writer,
compression: write::Compression::Snappy,
}
}

/// Set the compression used. Defaults to `Snappy`.
pub fn with_compression(mut self, compression: write::Compression) -> Self {
self.compression = compression;
self
}

/// Write the given DataFrame in the the writer `W`.
Expand Down Expand Up @@ -190,7 +200,7 @@ where

let options = write::WriteOptions {
write_statistics: false,
compression: write::Compression::Uncompressed,
compression: self.compression,
version: write::Version::V2,
};
let schema = ArrowSchema::new(fields);
Expand Down

0 comments on commit fe00bd7

Please sign in to comment.