| 496 | } |
| 497 | |
| 498 | void LocalPartition::addInput(RowVectorPtr input) { |
| 499 | { |
| 500 | auto lockedStats = stats_.wlock(); |
| 501 | lockedStats->addOutputVector(input->estimateFlatSize(), input->size()); |
| 502 | } |
| 503 | |
| 504 | // Lazy vectors must be loaded or processed. |
| 505 | for (auto& child : input->children()) { |
| 506 | child->loadedVector(); |
| 507 | } |
| 508 | |
| 509 | if (numPartitions_ == 1) { |
| 510 | ContinueFuture future; |
| 511 | auto blockingReason = queues_[0]->enqueue(input, &future); |
| 512 | if (FOLLY_UNLIKELY(blockingReason == BlockingReason::kYield)) { |
| 513 | // [morsel] when enqueue to any localExchangeQueue returns yield, it means |
| 514 | // the LocalExchangeQueues have been aborted (possibly due to |
| 515 | // skipProbeOnEmptyBuild, in this case, we need to issue noMoreInput to |
| 516 | // halt the driver. |
| 517 | |
| 518 | // @zj: find the correct way to yield producing pipeline when consuming |
| 519 | // pipeline is aborted in skipProbeOnEmptyBuild |
| 520 | // notifyPeersToTerminate(); |
| 521 | // noMoreInput(); |
| 522 | } else if (blockingReason != BlockingReason::kNotBlocked) { |
| 523 | blockingReasons_.push_back(blockingReason); |
| 524 | futures_.push_back(std::move(future)); |
| 525 | } |
| 526 | return; |
| 527 | } |
| 528 | |
| 529 | const auto singlePartition = |
| 530 | partitionFunction_->partition(*input, partitions_); |
| 531 | if (singlePartition.has_value()) { |
| 532 | ContinueFuture future; |
| 533 | auto blockingReason = |
| 534 | queues_[singlePartition.value()]->enqueue(input, &future); |
| 535 | if (FOLLY_UNLIKELY(blockingReason == BlockingReason::kYield)) { |
| 536 | // [morsel] when enqueue to any localExchangeQueue returns yield, it means |
| 537 | // the LocalExchangeQueues have been aborted (possibly due to |
| 538 | // skipProbeOnEmptyBuild, in this case, we need to issue noMoreInput to |
| 539 | // halt the driver. |
| 540 | |
| 541 | // @zj: find the correct way to yield producing pipeline when consuming |
| 542 | // pipeline is aborted in skipProbeOnEmptyBuild |
| 543 | // notifyPeersToTerminate(); |
| 544 | // noMoreInput(); |
| 545 | } else if (blockingReason != BlockingReason::kNotBlocked) { |
| 546 | blockingReasons_.push_back(blockingReason); |
| 547 | futures_.push_back(std::move(future)); |
| 548 | } |
| 549 | return; |
| 550 | } |
| 551 | |
| 552 | const auto numInput = input->size(); |
| 553 | std::vector<vector_size_t> maxIndex(numPartitions_, 0); |
| 554 | for (auto i = 0; i < numInput; ++i) { |
| 555 | ++maxIndex[partitions_[i]]; |
nothing calls this directly
no test coverage detected