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

Function WriteIpcPayload

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

Source from the content-addressed store, hash-verified

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