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

Function SerializeRecordBatch

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

Source from the content-addressed store, hash-verified

1608// Serialization public APIs
1609
1610Result<std::shared_ptr<Buffer>> SerializeRecordBatch(const RecordBatch& batch,
1611 std::shared_ptr<MemoryManager> mm) {
1612 auto options = IpcWriteOptions::Defaults();
1613 int64_t size = 0;
1614 RETURN_NOT_OK(GetRecordBatchSize(batch, options, &size));
1615 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Buffer> buffer, mm->AllocateBuffer(size));
1616 ARROW_ASSIGN_OR_RAISE(auto writer, Buffer::GetWriter(buffer));
1617
1618 // XXX Should we have a helper function for getting a MemoryPool
1619 // for any MemoryManager (not only CPU)?
1620 if (mm->is_cpu()) {
1621 options.memory_pool = checked_pointer_cast<CPUMemoryManager>(mm)->pool();
1622 }
1623 RETURN_NOT_OK(SerializeRecordBatch(batch, options, writer.get()));
1624 RETURN_NOT_OK(writer->Close());
1625 return buffer;
1626}
1627
1628Result<std::shared_ptr<Buffer>> SerializeRecordBatch(const RecordBatch& batch,
1629 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