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

Function DecompressBuffers

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

Source from the content-addressed store, hash-verified

593}
594
595Status DecompressBuffers(Compression::type compression, const IpcReadOptions& options,
596 ArrayDataVector* fields) {
597 struct BufferAccumulator {
598 using BufferPtrVector = std::vector<std::shared_ptr<Buffer>*>;
599
600 void AppendFrom(const ArrayDataVector& fields) {
601 for (const auto& field : fields) {
602 for (auto& buffer : field->buffers) {
603 buffers_.push_back(&buffer);
604 }
605 AppendFrom(field->child_data);
606 }
607 // Dictionary buffers are decompressed separately (see ReadDictionary).
608 }
609
610 BufferPtrVector Get(const ArrayDataVector& fields) && {
611 AppendFrom(fields);
612 return std::move(buffers_);
613 }
614
615 BufferPtrVector buffers_;
616 };
617
618 // Flatten all buffers
619 auto buffers = BufferAccumulator{}.Get(*fields);
620
621 std::unique_ptr<util::Codec> codec;
622 ARROW_ASSIGN_OR_RAISE(codec, util::Codec::Create(compression));
623
624 return ::arrow::internal::OptionalParallelFor(
625 options.use_threads, static_cast<int>(buffers.size()), [&](int i) {
626 ARROW_ASSIGN_OR_RAISE(*buffers[i],
627 DecompressBuffer(*buffers[i], options, codec.get()));
628 return Status::OK();
629 });
630}
631
632// Helper class to run post-ArrayLoader steps:
633// 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