| 493 | } |
| 494 | |
| 495 | Result<std::shared_ptr<FileWriter>> CsvFileFormat::MakeWriter( |
| 496 | std::shared_ptr<io::OutputStream> destination, std::shared_ptr<Schema> schema, |
| 497 | std::shared_ptr<FileWriteOptions> options, |
| 498 | fs::FileLocator destination_locator) const { |
| 499 | if (!Equals(*options->format())) { |
| 500 | return Status::TypeError("Mismatching format/write options."); |
| 501 | } |
| 502 | auto csv_options = checked_pointer_cast<CsvFileWriteOptions>(options); |
| 503 | ARROW_ASSIGN_OR_RAISE( |
| 504 | auto writer, csv::MakeCSVWriter(destination, schema, *csv_options->write_options)); |
| 505 | return std::shared_ptr<FileWriter>( |
| 506 | new CsvFileWriter(std::move(destination), std::move(writer), std::move(schema), |
| 507 | std::move(csv_options), std::move(destination_locator))); |
| 508 | } |
| 509 | |
| 510 | CsvFileWriter::CsvFileWriter(std::shared_ptr<io::OutputStream> destination, |
| 511 | std::shared_ptr<ipc::RecordBatchWriter> writer, |