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

Method Assemble

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 11

RoundUpToMultipleOf8Function · 0.85
IsMultipleOf8Function · 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