| 481 | } |
| 482 | |
| 483 | static std::pair<std::shared_ptr<exec::Task>, std::vector<RowVectorPtr>> |
| 484 | executeSerial( |
| 485 | core::PlanFragment plan, |
| 486 | const std::unordered_map<std::string, std::vector<std::string>>& |
| 487 | filePaths = {}) { |
| 488 | auto task = Task::create( |
| 489 | "single.execution.task.0", |
| 490 | plan, |
| 491 | 0, |
| 492 | core::QueryCtx::create(), |
| 493 | Task::ExecutionMode::kSerial); |
| 494 | |
| 495 | for (const auto& [nodeId, paths] : filePaths) { |
| 496 | for (const auto& path : paths) { |
| 497 | task->addSplit(nodeId, exec::Split(makeHiveConnectorSplit(path))); |
| 498 | } |
| 499 | task->noMoreSplits(nodeId); |
| 500 | } |
| 501 | |
| 502 | BOLT_CHECK(task->supportSerialExecutionMode()); |
| 503 | |
| 504 | vector_size_t numRows = 0; |
| 505 | std::vector<RowVectorPtr> results; |
| 506 | for (;;) { |
| 507 | auto result = task->next(); |
| 508 | if (!result) { |
| 509 | break; |
| 510 | } |
| 511 | |
| 512 | for (auto& child : result->children()) { |
| 513 | child->loadedVector(); |
| 514 | } |
| 515 | results.push_back(result); |
| 516 | numRows += result->size(); |
| 517 | } |
| 518 | |
| 519 | BOLT_CHECK(waitForTaskCompletion(task.get())); |
| 520 | |
| 521 | auto planNodeStats = toPlanStats(task->taskStats()); |
| 522 | BOLT_CHECK(planNodeStats.count(plan.planNode->id())); |
| 523 | BOLT_CHECK_EQ(numRows, planNodeStats.at(plan.planNode->id()).outputRows); |
| 524 | BOLT_CHECK_EQ( |
| 525 | results.size(), planNodeStats.at(plan.planNode->id()).outputVectors); |
| 526 | |
| 527 | return {task, results}; |
| 528 | } |
| 529 | }; |
| 530 | |
| 531 | TEST_F(TaskTest, sparkTaskAttemptId) { |
nothing calls this directly
no test coverage detected