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

Method pushdownFilters

bolt/exec/Driver.cpp:327–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327void Driver::pushdownFilters(int operatorIndex) {
328 auto* op = operators_[operatorIndex].get();
329 const auto& filters = op->getDynamicFilters();
330 if (filters.empty()) {
331 return;
332 }
333 const auto& planNodeId = op->planNodeId();
334
335 op->addRuntimeStat("dynamicFiltersProduced", RuntimeCounter(filters.size()));
336
337 // Walk operator list upstream and find a place to install the filters.
338 for (const auto& entry : filters) {
339 auto channel = entry.first;
340 for (auto i = operatorIndex - 1; i >= 0; --i) {
341 auto prevOp = operators_[i].get();
342
343 if (i == 0) {
344 // Source operator.
345 BOLT_CHECK(
346 prevOp->canAddDynamicFilter(),
347 "Cannot push down dynamic filters produced by {}",
348 op->toString());
349 prevOp->addDynamicFilter(planNodeId, channel, entry.second);
350 prevOp->addRuntimeStat("dynamicFiltersAccepted", RuntimeCounter(1));
351 break;
352 }
353
354 const auto& identityProjections = prevOp->identityProjections();
355 auto inputChannel = getIdentityProjection(identityProjections, channel);
356 if (!inputChannel.has_value()) {
357 // Filter channel is not an identity projection.
358 BOLT_CHECK(
359 prevOp->canAddDynamicFilter(),
360 "Cannot push down dynamic filters produced by {}",
361 op->toString());
362 prevOp->addDynamicFilter(planNodeId, channel, entry.second);
363 prevOp->addRuntimeStat("dynamicFiltersAccepted", RuntimeCounter(1));
364 break;
365 }
366
367 // Continue walking upstream.
368 channel = inputChannel.value();
369 }
370 }
371
372 op->clearDynamicFilters();
373}
374
375RowVectorPtr Driver::next(std::shared_ptr<BlockingState>& blockingState) {
376 enqueueInternal();

Callers

nothing calls this directly

Calls 12

RuntimeCounterClass · 0.85
getIdentityProjectionFunction · 0.85
has_valueMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
addRuntimeStatMethod · 0.45
sizeMethod · 0.45
canAddDynamicFilterMethod · 0.45
toStringMethod · 0.45
addDynamicFilterMethod · 0.45
valueMethod · 0.45
clearDynamicFiltersMethod · 0.45

Tested by

no test coverage detected