| 478 | } |
| 479 | |
| 480 | Result<std::shared_ptr<FileWriter>> CsvFileFormat::MakeWriter( |
| 481 | std::shared_ptr<io::OutputStream> destination, std::shared_ptr<Schema> schema, |
| 482 | std::shared_ptr<FileWriteOptions> options, |
| 483 | fs::FileLocator destination_locator) const { |
| 484 | if (!Equals(*options->format())) { |
| 485 | return Status::TypeError("Mismatching format/write options."); |
| 486 | } |
| 487 | auto csv_options = checked_pointer_cast<CsvFileWriteOptions>(options); |
| 488 | ARROW_ASSIGN_OR_RAISE( |
| 489 | auto writer, csv::MakeCSVWriter(destination, schema, *csv_options->write_options)); |
| 490 | return std::shared_ptr<FileWriter>( |
| 491 | new CsvFileWriter(std::move(destination), std::move(writer), std::move(schema), |
| 492 | std::move(csv_options), std::move(destination_locator))); |
| 493 | } |
| 494 | |
| 495 | CsvFileWriter::CsvFileWriter(std::shared_ptr<io::OutputStream> destination, |
| 496 | std::shared_ptr<ipc::RecordBatchWriter> writer, |