| 531 | } |
| 532 | |
| 533 | Result<DocPtrList> SQLEngineImpl::fill_result( |
| 534 | const std::vector<FieldAndSchema> &output_fields, |
| 535 | arrow::RecordBatchReader *reader) { |
| 536 | DocPtrList docs; |
| 537 | std::shared_ptr<RecordBatch> record_batch; |
| 538 | while (true) { |
| 539 | auto read_res = reader->ReadNext(&record_batch); |
| 540 | if (!read_res.ok()) { |
| 541 | return tl::make_unexpected( |
| 542 | Status::InternalError("Read next record batch failed (fill_result): ", |
| 543 | read_res.ToString())); |
| 544 | } |
| 545 | if (record_batch == nullptr) { |
| 546 | break; |
| 547 | } |
| 548 | size_t cur_size = docs.size(); |
| 549 | docs.resize(docs.size() + record_batch->num_rows()); |
| 550 | for (int i = 0; i < record_batch->num_rows(); i++) { |
| 551 | docs[cur_size + i] = std::make_shared<Doc>(); |
| 552 | } |
| 553 | auto status = record_batch_to_doc_list(output_fields, *record_batch, |
| 554 | docs.begin() + cur_size); |
| 555 | if (!status.ok()) { |
| 556 | return tl::make_unexpected(status); |
| 557 | } |
| 558 | } |
| 559 | return docs; |
| 560 | } |
| 561 | |
| 562 | |
| 563 | Result<GroupResults> SQLEngineImpl::fill_group_by_result( |
nothing calls this directly
no test coverage detected