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

Method Write

cpp/src/arrow/dataset/file_ipc_test.cc:47–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 public:
46 using FormatType = IpcFileFormat;
47 static Result<std::shared_ptr<Buffer>> Write(RecordBatchReader* reader) {
48 ARROW_ASSIGN_OR_RAISE(auto sink, io::BufferOutputStream::Create());
49 ARROW_ASSIGN_OR_RAISE(auto writer, ipc::MakeFileWriter(sink, reader->schema()));
50 ARROW_ASSIGN_OR_RAISE(auto batches, reader->ToRecordBatches());
51 for (auto batch : batches) {
52 RETURN_NOT_OK(writer->WriteRecordBatch(*batch));
53 }
54 RETURN_NOT_OK(writer->Close());
55 return sink->Finish();
56 }
57
58 static std::shared_ptr<IpcFileFormat> MakeFormat() {
59 return std::make_shared<IpcFileFormat>();

Callers

nothing calls this directly

Calls 3

WriteRecordBatchMethod · 0.45
CloseMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected