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

Method Assemble

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

Source from the content-addressed store, hash-verified

1023 }
1024
1025 Status Assemble(const SparseTensor& sparse_tensor) {
1026 if (!buffer_meta_.empty()) {
1027 buffer_meta_.clear();
1028 out_->body_buffers.clear();
1029 }
1030
1031 RETURN_NOT_OK(VisitSparseIndex(*sparse_tensor.sparse_index()));
1032 out_->body_buffers.emplace_back(sparse_tensor.data());
1033
1034 int64_t offset = buffer_start_offset_;
1035 buffer_meta_.reserve(out_->body_buffers.size());
1036 int64_t raw_size = 0;
1037
1038 for (size_t i = 0; i < out_->body_buffers.size(); ++i) {
1039 const Buffer* buffer = out_->body_buffers[i].get();
1040 int64_t size = buffer->size();
1041 int64_t padding = bit_util::RoundUpToMultipleOf8(size) - size;
1042 buffer_meta_.push_back({offset, size + padding});
1043 offset += size + padding;
1044 raw_size += size;
1045 }
1046
1047 out_->body_length = offset - buffer_start_offset_;
1048 DCHECK(bit_util::IsMultipleOf8(out_->body_length));
1049 out_->raw_body_length = raw_size;
1050
1051 return SerializeMetadata(sparse_tensor);
1052 }
1053
1054 private:
1055 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