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

Method Assemble

cpp/src/arrow/ipc/writer.cc:1037–1064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035 }
1036
1037 Status Assemble(const SparseTensor& sparse_tensor) {
1038 if (!buffer_meta_.empty()) {
1039 buffer_meta_.clear();
1040 out_->body_buffers.clear();
1041 }
1042
1043 RETURN_NOT_OK(VisitSparseIndex(*sparse_tensor.sparse_index()));
1044 out_->body_buffers.emplace_back(sparse_tensor.data());
1045
1046 int64_t offset = buffer_start_offset_;
1047 buffer_meta_.reserve(out_->body_buffers.size());
1048 int64_t raw_size = 0;
1049
1050 for (size_t i = 0; i < out_->body_buffers.size(); ++i) {
1051 const Buffer* buffer = out_->body_buffers[i].get();
1052 int64_t size = buffer->size();
1053 int64_t padding = bit_util::RoundUpToMultipleOf8(size) - size;
1054 buffer_meta_.push_back({offset, size + padding});
1055 offset += size + padding;
1056 raw_size += size;
1057 }
1058
1059 out_->body_length = offset - buffer_start_offset_;
1060 DCHECK(bit_util::IsMultipleOf8(out_->body_length));
1061 out_->raw_body_length = raw_size;
1062
1063 return SerializeMetadata(sparse_tensor);
1064 }
1065
1066 private:
1067 Status VisitSparseCOOIndex(const SparseCOOIndex& sparse_index) {

Callers

nothing calls this directly

Calls 12

RoundUpToMultipleOf8Function · 0.85
IsMultipleOf8Function · 0.85
SerializeMetadataFunction · 0.85
sparse_indexMethod · 0.80
emplace_backMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
dataMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected