MCPcopy Create free account
hub / github.com/bytedance/bolt / addInput

Method addInput

bolt/exec/LocalPartition.cpp:498–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498void 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]];

Callers

nothing calls this directly

Calls 15

allocateIndicesFunction · 0.85
getRawIndicesFunction · 0.85
addOutputVectorMethod · 0.80
has_valueMethod · 0.80
BufferReleaserClass · 0.70
wrapChildrenFunction · 0.70
poolFunction · 0.50
createFunction · 0.50
estimateFlatSizeMethod · 0.45
sizeMethod · 0.45
childrenMethod · 0.45
loadedVectorMethod · 0.45

Tested by

no test coverage detected