Converts a stream from stdin to a file written to standard out. A typical usage would be: $ | stream-to-file > file.arrow
| 32 | // A typical usage would be: |
| 33 | // $ <program that produces streaming output> | stream-to-file > file.arrow |
| 34 | Status ConvertToFile() { |
| 35 | io::StdinStream input; |
| 36 | io::StdoutStream sink; |
| 37 | |
| 38 | IpcWriteOptions write_options; |
| 39 | write_options.emit_dictionary_deltas = true; |
| 40 | ARROW_ASSIGN_OR_RAISE(auto reader, RecordBatchStreamReader::Open(&input)); |
| 41 | ARROW_ASSIGN_OR_RAISE(auto writer, |
| 42 | MakeFileWriter(&sink, reader->schema(), write_options)); |
| 43 | std::shared_ptr<RecordBatch> batch; |
| 44 | while (true) { |
| 45 | ARROW_ASSIGN_OR_RAISE(batch, reader->Next()); |
| 46 | if (batch == nullptr) break; |
| 47 | RETURN_NOT_OK(writer->WriteRecordBatch(*batch)); |
| 48 | } |
| 49 | return writer->Close(); |
| 50 | } |
| 51 | |
| 52 | } // namespace ipc |
| 53 | } // namespace arrow |
no test coverage detected