Skip to content

Commit

Permalink
Merge pull request #193 from klauspost/use-pure-go-zstd
Browse files Browse the repository at this point in the history
Use pure Go Zstandard
  • Loading branch information
xitongsys committed Dec 16, 2019
2 parents adca8ee + 6b151ce commit 706116f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compress/gzip.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package compress

import (
"bytes"
"compress/gzip"
"github.com/klauspost/compress/gzip"
"github.com/xitongsys/parquet-go/parquet"
"io/ioutil"
)
Expand Down
10 changes: 6 additions & 4 deletions compress/zstd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
package compress

import (
"github.com/DataDog/zstd"
"github.com/klauspost/compress/zstd"
"github.com/xitongsys/parquet-go/parquet"
)

func init() {
// Create encoder/decoder with default parameters.
enc, _ := zstd.NewWriter(nil, zstd.WithZeroFrames(true))
dec, _ := zstd.NewReader(nil)
compressors[parquet.CompressionCodec_ZSTD] = &Compressor{
Compress: func(buf []byte) []byte {
res, _ := zstd.Compress(nil, buf)
return res
return enc.EncodeAll(buf, nil)
},
Uncompress: func(buf []byte) (bytes []byte, err error) {
return zstd.Decompress(nil, buf)
return dec.DecodeAll(buf, nil)
},
}
}

0 comments on commit 706116f

Please sign in to comment.