MCPcopy Create free account
hub / github.com/apache/arrow / Compress

Method Compress

cpp/src/arrow/util/compression_lz4.cc:360–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358 }
359
360 Result<int64_t> Compress(int64_t input_len, const uint8_t* input,
361 int64_t output_buffer_len, uint8_t* output_buffer) override {
362 int64_t output_len;
363#ifdef LZ4HC_CLEVEL_MIN
364 constexpr int min_hc_clevel = LZ4HC_CLEVEL_MIN;
365#else // For older versions of the lz4 library
366 constexpr int min_hc_clevel = 3;
367#endif
368 if (compression_level_ < min_hc_clevel) {
369 output_len = LZ4_compress_default(
370 reinterpret_cast<const char*>(input), reinterpret_cast<char*>(output_buffer),
371 static_cast<int>(input_len), static_cast<int>(output_buffer_len));
372 } else {
373 output_len = LZ4_compress_HC(
374 reinterpret_cast<const char*>(input), reinterpret_cast<char*>(output_buffer),
375 static_cast<int>(input_len), static_cast<int>(output_buffer_len),
376 compression_level_);
377 }
378 if (output_len == 0) {
379 return Status::IOError("Lz4 compression failure.");
380 }
381 return output_len;
382 }
383
384 Result<std::shared_ptr<Compressor>> MakeCompressor() override {
385 return Status::NotImplemented(

Callers 9

CompressDataOneShotFunction · 0.45
WriteMethod · 0.45
StreamingCompressFunction · 0.45
CompressFunction · 0.45
CheckCodecRoundtripFunction · 0.45
TESTFunction · 0.45
TEST_PFunction · 0.45

Calls 1

IOErrorFunction · 0.85

Tested by 5

CompressDataOneShotFunction · 0.36
CheckCodecRoundtripFunction · 0.36
TESTFunction · 0.36
TEST_PFunction · 0.36