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

Function DecompressBuffers

cpp/src/arrow/ipc/reader.cc:580–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580Status DecompressBuffers(Compression::type compression, const IpcReadOptions& options,
581 ArrayDataVector* fields) {
582 struct BufferAccumulator {
583 using BufferPtrVector = std::vector<std::shared_ptr<Buffer>*>;
584
585 void AppendFrom(const ArrayDataVector& fields) {
586 for (const auto& field : fields) {
587 for (auto& buffer : field->buffers) {
588 buffers_.push_back(&buffer);
589 }
590 AppendFrom(field->child_data);
591 }
592 // Dictionary buffers are decompressed separately (see ReadDictionary).
593 }
594
595 BufferPtrVector Get(const ArrayDataVector& fields) && {
596 AppendFrom(fields);
597 return std::move(buffers_);
598 }
599
600 BufferPtrVector buffers_;
601 };
602
603 // Flatten all buffers
604 auto buffers = BufferAccumulator{}.Get(*fields);
605
606 std::unique_ptr<util::Codec> codec;
607 ARROW_ASSIGN_OR_RAISE(codec, util::Codec::Create(compression));
608
609 return ::arrow::internal::OptionalParallelFor(
610 options.use_threads, static_cast<int>(buffers.size()), [&](int i) {
611 ARROW_ASSIGN_OR_RAISE(*buffers[i],
612 DecompressBuffer(*buffers[i], options, codec.get()));
613 return Status::OK();
614 });
615}
616
617// Helper class to run post-ArrayLoader steps:
618// buffer decompression, dictionary resolution, buffer re-alignment.

Callers 1

CreateColumnsMethod · 0.85

Calls 7

OptionalParallelForFunction · 0.85
DecompressBufferFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.70
OKFunction · 0.50
GetMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected