| 391 | } |
| 392 | |
| 393 | void Task::init(std::optional<common::SpillDiskOptions>&& spillDiskOpts) { |
| 394 | BOLT_CHECK(driverFactories_.empty()); |
| 395 | initTaskPool(); |
| 396 | |
| 397 | setSpillDiskConfig(std::move(spillDiskOpts)); |
| 398 | |
| 399 | if (mode_ != Task::ExecutionMode::kSerial) { |
| 400 | return; |
| 401 | } |
| 402 | |
| 403 | // Create drivers. |
| 404 | BOLT_CHECK_NULL( |
| 405 | consumerSupplier_, |
| 406 | "Serial execution mode doesn't support delivering results to a " |
| 407 | "callback"); |
| 408 | |
| 409 | taskStats_.executionStartTimeMs = getCurrentTimeMs(); |
| 410 | LocalPlanner::plan( |
| 411 | planFragment_, |
| 412 | nullptr, |
| 413 | &driverFactories_, |
| 414 | queryCtx_->queryConfig(), |
| 415 | 1, |
| 416 | queryCtx_->queryConfig().isMultiDriverEnabled()); |
| 417 | exchangeClients_.resize(driverFactories_.size()); |
| 418 | |
| 419 | // In Task::next() we always assume ungrouped execution. |
| 420 | for (const auto& factory : driverFactories_) { |
| 421 | BOLT_CHECK(factory->supportsSerialExecution()); |
| 422 | numDriversUngrouped_ += factory->numDrivers; |
| 423 | numTotalDrivers_ += factory->numTotalDrivers; |
| 424 | taskStats_.pipelineStats.emplace_back( |
| 425 | factory->inputDriver, factory->outputDriver, factory->isMorselDriven()); |
| 426 | } |
| 427 | |
| 428 | // Create drivers. |
| 429 | createSplitGroupStateLocked(kUngroupedGroupId); |
| 430 | std::vector<std::shared_ptr<Driver>> drivers = |
| 431 | createDriversLocked(kUngroupedGroupId); |
| 432 | if (pool_->reservedBytes() != 0) { |
| 433 | BOLT_FAIL( |
| 434 | "Unexpected memory pool allocations during task[{}] driver initialization: {}", |
| 435 | taskId_, |
| 436 | pool_->treeMemoryUsage()); |
| 437 | } |
| 438 | |
| 439 | drivers_ = std::move(drivers); |
| 440 | } |
| 441 | |
| 442 | void Task::setSpillDiskConfig( |
| 443 | std::optional<common::SpillDiskOptions>&& spillDiskOpts) { |
no test coverage detected