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

Method next

bolt/exec/MergeSource.cpp:232–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230 }
231
232 BlockingReason next(RowVectorPtr& data, ContinueFuture* future) override {
233 data.reset();
234
235 if (atEnd_ && !currentPage_) {
236 return BlockingReason::kNotBlocked;
237 }
238
239 if (!currentPage_) {
240 auto pages = client_->next(1, &atEnd_, future);
241 BOLT_CHECK_LE(pages.size(), 1);
242 currentPage_ = pages.empty() ? nullptr : std::move(pages.front());
243
244 if (!currentPage_) {
245 if (atEnd_) {
246 return BlockingReason::kNotBlocked;
247 }
248 return BlockingReason::kWaitForProducer;
249 }
250 }
251 if (inputStream_ == nullptr) {
252 mergeExchange_->stats().wlock()->rawInputBytes += currentPage_->size();
253 inputStream_ = currentPage_->prepareStreamForDeserialize();
254 }
255
256 if (!inputStream_->atEnd()) {
257 static const serializer::presto::PrestoVectorSerde::PrestoOptions options(
258 false, common::CompressionKind::CompressionKind_ZSTD);
259 VectorStreamGroup::read(
260 inputStream_.get(),
261 mergeExchange_->pool(),
262 mergeExchange_->outputType(),
263 &data,
264 &options);
265
266 auto lockedStats = mergeExchange_->stats().wlock();
267 lockedStats->addInputVector(data->estimateFlatSize(), data->size());
268 lockedStats->rawInputPositions += data->size();
269 }
270
271 // Since VectorStreamGroup::read() may cause inputStream to be at end,
272 // check again and reset currentPage_ and inputStream_ here.
273 if (inputStream_->atEnd()) {
274 // Reached end of the stream.
275 currentPage_ = nullptr;
276 inputStream_.reset();
277 }
278
279 return BlockingReason::kNotBlocked;
280 }
281
282 void close() override {
283 if (client_) {

Callers

nothing calls this directly

Calls 13

outputTypeMethod · 0.80
addInputVectorMethod · 0.80
readFunction · 0.50
resetMethod · 0.45
nextMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
statsMethod · 0.45
atEndMethod · 0.45
getMethod · 0.45
poolMethod · 0.45

Tested by

no test coverage detected