| 626 | } |
| 627 | |
| 628 | Result<std::shared_ptr<RecordBatch>> Table::CombineChunksToBatch(MemoryPool* pool) const { |
| 629 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Table> combined, CombineChunks(pool)); |
| 630 | std::vector<std::shared_ptr<Array>> arrays; |
| 631 | for (const auto& column : combined->columns()) { |
| 632 | if (column->num_chunks() == 0) { |
| 633 | DCHECK_EQ(num_rows(), 0) << "Empty chunk with more than 0 rows"; |
| 634 | ARROW_ASSIGN_OR_RAISE(auto chunk, |
| 635 | MakeArrayOfNull(column->type(), num_rows(), pool)); |
| 636 | arrays.push_back(std::move(chunk)); |
| 637 | } else { |
| 638 | arrays.push_back(column->chunk(0)); |
| 639 | } |
| 640 | } |
| 641 | return RecordBatch::Make(schema_, num_rows_, std::move(arrays)); |
| 642 | } |
| 643 | // ---------------------------------------------------------------------- |
| 644 | // Convert a table to a sequence of record batches |
| 645 | |