HuaHuaY commented on code in PR #48865:
URL: https://github.com/apache/arrow/pull/48865#discussion_r2695178171


##########
cpp/src/arrow/util/compression_zstd.cc:
##########
@@ -207,24 +198,24 @@ class ZSTDCodec : public Codec {
 
   Result<int64_t> Compress(int64_t input_len, const uint8_t* input,
                            int64_t output_buffer_len, uint8_t* output_buffer) 
override {
-    size_t ret = ZSTD_compress(output_buffer, 
static_cast<size_t>(output_buffer_len),
-                               input, static_cast<size_t>(input_len), 
compression_level_);
+    ARROW_ASSIGN_OR_RAISE(auto cctx, CreateCCtx());
+    size_t ret = ZSTD_compressCCtx(cctx.get(), output_buffer,
+                                   static_cast<size_t>(output_buffer_len), 
input,
+                                   static_cast<size_t>(input_len), 
compression_level_);

Review Comment:
   Context will also be passed to `ZSTDCompressor` and it needs 
`compression_level_`. We can move `auto ret = 
ZSTD_CCtx_setParameter(cctx.get(), ZSTD_c_compressionLevel, 
compression_level_)` to `MakeCompressor` though I think the readability will 
decrease a bit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to