| 45 | public: |
| 46 | using FormatType = CsvFileFormat; |
| 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 table, reader->ToTable()); |
| 50 | auto options = csv::WriteOptions::Defaults(); |
| 51 | RETURN_NOT_OK(csv::WriteCSV(*table, options, sink.get())); |
| 52 | return sink->Finish(); |
| 53 | } |
| 54 | |
| 55 | static std::shared_ptr<CsvFileFormat> MakeFormat() { |
| 56 | auto format = std::make_shared<CsvFileFormat>(); |