| 118 | } |
| 119 | |
| 120 | void NestedLoopJoinBuild::noMoreInput() { |
| 121 | Operator::noMoreInput(); |
| 122 | std::vector<ContinuePromise> promises; |
| 123 | std::vector<std::shared_ptr<Driver>> peers; |
| 124 | // The last Driver to hit NestedLoopJoinBuild::finish gathers the data from |
| 125 | // all build Drivers and hands it over to the probe side. At this |
| 126 | // point all build Drivers are continued and will free their |
| 127 | // state. allPeersFinished is true only for the last Driver of the |
| 128 | // build pipeline. |
| 129 | if (!operatorCtx_->task()->allPeersFinished( |
| 130 | planNodeId(), operatorCtx_->driver(), &future_, promises, peers)) { |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | { |
| 135 | auto promisesGuard = folly::makeGuard([&]() { |
| 136 | // Realize the promises so that the other Drivers (which were not |
| 137 | // the last to finish) can continue from the barrier and finish. |
| 138 | peers.clear(); |
| 139 | for (auto& promise : promises) { |
| 140 | promise.setValue(); |
| 141 | } |
| 142 | }); |
| 143 | |
| 144 | for (auto& peer : peers) { |
| 145 | auto op = peer->findOperator(planNodeId()); |
| 146 | auto* build = dynamic_cast<NestedLoopJoinBuild*>(op); |
| 147 | BOLT_CHECK_NOT_NULL(build); |
| 148 | dataVectors_.insert( |
| 149 | dataVectors_.begin(), |
| 150 | build->dataVectors_.begin(), |
| 151 | build->dataVectors_.end()); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | dataVectors_ = mergeDataVectors(); |
| 156 | operatorCtx_->task() |
| 157 | ->getNestedLoopJoinBridge( |
| 158 | operatorCtx_->driverCtx()->splitGroupId, planNodeId()) |
| 159 | ->setData(std::move(dataVectors_)); |
| 160 | } |
| 161 | |
| 162 | bool NestedLoopJoinBuild::isFinished() { |
| 163 | return !future_.valid() && noMoreInput_; |
nothing calls this directly
no test coverage detected