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