| 118 | } |
| 119 | |
| 120 | void noMoreInput() override { |
| 121 | Operator::noMoreInput(); |
| 122 | std::vector<ContinuePromise> promises; |
| 123 | std::vector<std::shared_ptr<Driver>> peers; |
| 124 | // The last Driver to hit CustomJoinBuild::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 | for (auto& peer : peers) { |
| 135 | auto op = peer->findOperator(planNodeId()); |
| 136 | auto* build = dynamic_cast<CustomJoinBuild*>(op); |
| 137 | BOLT_CHECK(build); |
| 138 | numRows_ += build->numRows_; |
| 139 | } |
| 140 | |
| 141 | // Realize the promises so that the other Drivers (which were not |
| 142 | // the last to finish) can continue from the barrier and finish. |
| 143 | peers.clear(); |
| 144 | for (auto& promise : promises) { |
| 145 | promise.setValue(); |
| 146 | } |
| 147 | |
| 148 | auto joinBridge = operatorCtx_->task()->getCustomJoinBridge( |
| 149 | operatorCtx_->driverCtx()->splitGroupId, planNodeId()); |
| 150 | auto customJoinBridge = |
| 151 | std::dynamic_pointer_cast<CustomJoinBridge>(joinBridge); |
| 152 | customJoinBridge->setNumRows(std::make_optional(numRows_)); |
| 153 | } |
| 154 | |
| 155 | BlockingReason isBlocked(ContinueFuture* future) override { |
| 156 | if (!future_.valid()) { |
nothing calls this directly
no test coverage detected