| 104 | } |
| 105 | |
| 106 | Result<std::shared_ptr<Buffer>> SerializeRecordBatch( |
| 107 | const std::shared_ptr<RecordBatch>& batch, const IpcWriteOptions& options, |
| 108 | bool is_stream_format) { |
| 109 | ARROW_ASSIGN_OR_RAISE(auto sink, io::BufferOutputStream::Create(1024)); |
| 110 | std::shared_ptr<RecordBatchWriter> writer; |
| 111 | if (is_stream_format) { |
| 112 | ARROW_ASSIGN_OR_RAISE(writer, MakeStreamWriter(sink, batch->schema(), options)); |
| 113 | } else { |
| 114 | ARROW_ASSIGN_OR_RAISE(writer, MakeFileWriter(sink, batch->schema(), options)); |
| 115 | } |
| 116 | RETURN_NOT_OK(writer->WriteRecordBatch(*batch)); |
| 117 | RETURN_NOT_OK(writer->Close()); |
| 118 | return sink->Finish(); |
| 119 | } |
| 120 | |
| 121 | Status DoMain(bool is_stream_format, const std::string& out_dir) { |
| 122 | ARROW_ASSIGN_OR_RAISE(auto dir_fn, PlatformFilename::FromString(out_dir)); |
nothing calls this directly
no test coverage detected