File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ import (
99)
1010
1111func init () {
12- lz4hc := lz4.CompressorHC {
13- Level : lz4 .CompressionLevel (9 ),
14- }
1512 compressors [parquet .CompressionCodec_LZ4_RAW ] = & Compressor {
1613 Compress : func (buf []byte ) []byte {
14+ lz4hc := lz4.CompressorHC {
15+ Level : lz4 .CompressionLevel (9 ),
16+ }
1717 res := make ([]byte , lz4 .CompressBlockBound (len (buf )))
1818 count , _ := lz4hc .CompressBlock (buf , res )
1919 return res [:count ]
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package compress
22
33import (
44 "bytes"
5+ "sync"
56 "testing"
67
78 "github.com/xitongsys/parquet-go/parquet"
@@ -15,10 +16,18 @@ func TestLz4RawCompress(t *testing.T) {
1516 }
1617
1718 // compression
18- output := lz4RawCompressor .Compress (input )
19- if ! bytes .Equal (compressed , output ) {
20- t .Fatalf ("expected output %s but was %s" , string (compressed ), string (output ))
19+ var wg sync.WaitGroup
20+ for i := 0 ; i < 10 ; i ++ {
21+ go func () {
22+ wg .Add (1 )
23+ defer wg .Done ()
24+ output := lz4RawCompressor .Compress (input )
25+ if ! bytes .Equal (compressed , output ) {
26+ t .Fatalf ("expected output %s but was %s" , string (compressed ), string (output ))
27+ }
28+ }()
2129 }
30+ wg .Wait ()
2231
2332 // uncompression
2433 output , err := lz4RawCompressor .Uncompress (compressed )
You can’t perform that action at this time.
0 commit comments