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

Function SerializeRecordBatch

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

Source from the content-addressed store, hash-verified

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