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

Function WriteIpcPayload

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

Source from the content-addressed store, hash-verified

766} // namespace
767
768Status WriteIpcPayload(const IpcPayload& payload, const IpcWriteOptions& options,
769 io::OutputStream* dst, int32_t* metadata_length) {
770 RETURN_NOT_OK(WriteMessage(*payload.metadata, options, dst, metadata_length));
771
772#ifndef NDEBUG
773 RETURN_NOT_OK(CheckAligned(dst));
774#endif
775
776 // Now write the buffers
777 for (size_t i = 0; i < payload.body_buffers.size(); ++i) {
778 const std::shared_ptr<Buffer>& buffer = payload.body_buffers[i];
779 int64_t size = 0;
780 int64_t padding = 0;
781
782 // The buffer might be null if we are handling zero row lengths.
783 if (buffer) {
784 size = buffer->size();
785 padding = bit_util::RoundUpToMultipleOf8(size) - size;
786 }
787
788 if (size > 0) {
789 RETURN_NOT_OK(dst->Write(buffer));
790 }
791
792 if (padding > 0) {
793 RETURN_NOT_OK(dst->Write(kPaddingBytes, padding));
794 }
795 }
796
797#ifndef NDEBUG
798 RETURN_NOT_OK(CheckAligned(dst));
799#endif
800
801 return Status::OK();
802}
803
804Status GetSchemaPayload(const Schema& schema, const IpcWriteOptions& options,
805 const DictionaryFieldMapper& mapper, IpcPayload* out) {

Callers 6

TEST_PFunction · 0.85
SpliceMessagesFunction · 0.85
WriteRecordBatchFunction · 0.85
WriteSparseTensorFunction · 0.85
WritePayloadMethod · 0.85
WritePayloadMethod · 0.85

Calls 6

WriteMessageFunction · 0.85
RoundUpToMultipleOf8Function · 0.85
CheckAlignedFunction · 0.70
OKFunction · 0.50
sizeMethod · 0.45
WriteMethod · 0.45

Tested by 2

TEST_PFunction · 0.68
SpliceMessagesFunction · 0.68