arrow::Status DumpRecipeOutput()

in cpp/code/common.cc [145:161]


arrow::Status DumpRecipeOutput(const std::string& output_filename) {
  ARROW_ASSIGN_OR_RAISE(std::shared_ptr<arrow::Table> new_table,
                        CreateRecipeOutputTable());
  ARROW_ASSIGN_OR_RAISE(std::shared_ptr<arrow::Table> old_table,
                        LoadExistingRecipeOutputTable(output_filename));
  ARROW_ASSIGN_OR_RAISE(std::shared_ptr<arrow::Table> merged_table,
                        MergeRecipeTables(old_table, new_table));
  std::shared_ptr<arrow::fs::FileSystem> fs =
      std::make_shared<arrow::fs::LocalFileSystem>();
  ARROW_ASSIGN_OR_RAISE(std::shared_ptr<arrow::io::OutputStream> out_stream,
                        fs->OpenOutputStream(output_filename));
  ARROW_ASSIGN_OR_RAISE(
      std::shared_ptr<arrow::ipc::RecordBatchWriter> writer,
      arrow::ipc::MakeStreamWriter(out_stream.get(), merged_table->schema()));
  RETURN_NOT_OK(writer->WriteTable(*merged_table));
  return writer->Close();
}