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

Function WriteIpcPayload

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

Source from the content-addressed store, hash-verified

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