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

Function SerializeRecordBatch

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

Source from the content-addressed store, hash-verified

1624// Serialization public APIs
1625
1626Result<std::shared_ptr<Buffer>> SerializeRecordBatch(const RecordBatch& batch,
1627 std::shared_ptr<MemoryManager> mm) {
1628 auto options = IpcWriteOptions::Defaults();
1629 int64_t size = 0;
1630 RETURN_NOT_OK(GetRecordBatchSize(batch, options, &size));
1631 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Buffer> buffer, mm->AllocateBuffer(size));
1632 ARROW_ASSIGN_OR_RAISE(auto writer, Buffer::GetWriter(buffer));
1633
1634 // XXX Should we have a helper function for getting a MemoryPool
1635 // for any MemoryManager (not only CPU)?
1636 if (mm->is_cpu()) {
1637 options.memory_pool = checked_pointer_cast<CPUMemoryManager>(mm)->pool();
1638 }
1639 RETURN_NOT_OK(SerializeRecordBatch(batch, options, writer.get()));
1640 RETURN_NOT_OK(writer->Close());
1641 return buffer;
1642}
1643
1644Result<std::shared_ptr<Buffer>> SerializeRecordBatch(const RecordBatch& batch,
1645 const IpcWriteOptions& options) {

Callers 5

DoStandardRoundTripMethod · 0.70
TEST_FFunction · 0.70

Calls 9

GetRecordBatchSizeFunction · 0.85
ARROW_ASSIGN_OR_RAISEFunction · 0.70
WriteRecordBatchFunction · 0.70
DefaultsFunction · 0.50
AllocateBufferFunction · 0.50
AllocateBufferMethod · 0.45
poolMethod · 0.45
getMethod · 0.45
CloseMethod · 0.45

Tested by 2

DoStandardRoundTripMethod · 0.56
TEST_FFunction · 0.56