| 703 | } |
| 704 | |
| 705 | Status ExportRecordBatch(const RecordBatch& batch, struct ArrowArray* out, |
| 706 | struct ArrowSchema* out_schema) { |
| 707 | // XXX perhaps bypass ToStructArray() for speed? |
| 708 | ARROW_ASSIGN_OR_RAISE(auto array, batch.ToStructArray()); |
| 709 | |
| 710 | SchemaExportGuard guard(out_schema); |
| 711 | if (out_schema != nullptr) { |
| 712 | // Export the schema, not the struct type, so as not to lose top-level metadata |
| 713 | RETURN_NOT_OK(ExportSchema(*batch.schema(), out_schema)); |
| 714 | } |
| 715 | ArrayExporter exporter; |
| 716 | RETURN_NOT_OK(exporter.Export(array->data())); |
| 717 | exporter.Finish(out); |
| 718 | guard.Detach(); |
| 719 | return Status::OK(); |
| 720 | } |
| 721 | |
| 722 | ////////////////////////////////////////////////////////////////////////// |
| 723 | // C device arrays |