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