From f9fb5367878a23bf7336fd3e1628079c385a4d70 Mon Sep 17 00:00:00 2001 From: Hang Xie <7977860+hangxie@users.noreply.github.com> Date: Fri, 16 Aug 2024 19:16:26 -0700 Subject: [PATCH] fix race condition in lz4_raw compression --- compress/lz4_raw.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compress/lz4_raw.go b/compress/lz4_raw.go index a6fd23cb..aae28e21 100644 --- a/compress/lz4_raw.go +++ b/compress/lz4_raw.go @@ -9,11 +9,11 @@ import ( ) func init() { - lz4hc := lz4.CompressorHC{ - Level: lz4.CompressionLevel(9), - } compressors[parquet.CompressionCodec_LZ4_RAW] = &Compressor{ Compress: func(buf []byte) []byte { + lz4hc := lz4.CompressorHC{ + Level: lz4.CompressionLevel(9), + } res := make([]byte, lz4.CompressBlockBound(len(buf))) count, _ := lz4hc.CompressBlock(buf, res) return res[:count]