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

Method Decompress

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

Source from the content-addressed store, hash-verified

277 }
278
279 Result<int64_t> Decompress(int64_t input_len, const uint8_t* input,
280 int64_t output_buffer_len, uint8_t* output_buffer) override {
281 ARROW_ASSIGN_OR_RAISE(auto decomp, MakeDecompressor());
282
283 int64_t total_bytes_written = 0;
284 while (!decomp->IsFinished() && input_len != 0) {
285 ARROW_ASSIGN_OR_RAISE(
286 auto res,
287 decomp->Decompress(input_len, input, output_buffer_len, output_buffer));
288 input += res.bytes_read;
289 input_len -= res.bytes_read;
290 output_buffer += res.bytes_written;
291 output_buffer_len -= res.bytes_written;
292 total_bytes_written += res.bytes_written;
293 if (res.need_more_output) {
294 return Status::IOError("Lz4 decompression buffer too small");
295 }
296 }
297 if (!decomp->IsFinished()) {
298 return Status::IOError("Lz4 compressed input contains less than one frame");
299 }
300 if (input_len != 0) {
301 return Status::IOError("Lz4 compressed input contains more than one frame");
302 }
303 return total_bytes_written;
304 }
305
306 Result<std::shared_ptr<Compressor>> MakeCompressor() override {
307 auto ptr = std::make_shared<LZ4Compressor>(compression_level_);

Callers

nothing calls this directly

Calls 2

IOErrorFunction · 0.85
IsFinishedMethod · 0.45

Tested by

no test coverage detected