MCPcopy Create free account
hub / github.com/alibaba/zvec / fill_result

Method fill_result

src/db/sqlengine/sqlengine_impl.cc:533–560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531}
532
533Result<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
563Result<GroupResults> SQLEngineImpl::fill_group_by_result(

Callers

nothing calls this directly

Calls 9

make_unexpectedFunction · 0.85
InternalErrorFunction · 0.85
record_batch_to_doc_listFunction · 0.85
num_rowsMethod · 0.80
ReadNextMethod · 0.45
okMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected