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

Method evalFilter

bolt/exec/HashProbe.cpp:1530–1726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1528 BaseHashTable::RowsIterator iter;
1529 crossJoinProbeRows.deselect(filterPassedRows);
1530 applyFilterOnTableRowsForNullAwareJoin(
1531 crossJoinProbeRows, filterPassedRows, [&](char** data, int32_t maxRows) {
1532 return table_->listAllRows(
1533 &iter, maxRows, RowContainer::kUnlimited, data);
1534 });
1535 filterPassedRows.updateBounds();
1536
1537 return filterPassedRows;
1538}
1539
1540int32_t HashProbe::evalFilter(int32_t numRows) {
1541 if (!filter_) {
1542 return numRows;
1543 }
1544
1545 const bool filterPropagateNulls = filter_->expr(0)->propagatesNulls();
1546 auto* rawOutputProbeRowMapping =
1547 outputRowMapping_->asMutable<vector_size_t>();
1548
1549 filterInputRows_.resizeFill(numRows);
1550
1551 // Do not evaluate filter on rows with no match to (1) avoid
1552 // false-positives when filter evaluates to true for rows with NULLs on the
1553 // build side; (2) avoid errors in filter evaluation that would fail the
1554 // query unnecessarily.
1555 // TODO Apply the same to left joins.
1556 if (isAntiJoin(joinType_) || isLeftSemiProjectJoin(joinType_)) {
1557 for (auto i = 0; i < numRows; ++i) {
1558 if (outputTableRows_[i] == nullptr) {
1559 filterInputRows_.setValid(i, false);
1560 }
1561 }
1562 filterInputRows_.updateBounds();
1563 }
1564
1565 if (FOLLY_LIKELY(filterInputRows_.hasSelections())) {
1566 auto filterInput = fillFilterInput(numRows);
1567 if (nullAware_) {
1568 prepareFilterRowsForNullAwareJoin(
1569 filterInput.get(), numRows, filterPropagateNulls);
1570 }
1571
1572 EvalCtx evalCtx(operatorCtx_->execCtx(), filter_.get(), filterInput.get());
1573 filter_->eval(0, 1, true, filterInputRows_, evalCtx, filterResult_);
1574
1575 decodedFilterResult_.decode(*filterResult_[0], filterInputRows_);
1576 } else if (nullAware_) {
1577 prepareFilterRowsForNullAwareJoin(nullptr, numRows, filterPropagateNulls);
1578 }
1579
1580 int32_t numPassed = 0;
1581 if (isLeftJoin(joinType_) || isFullJoin(joinType_)) {
1582 if (probeRangePartition_) {
1583 if (includingMiss_) {
1584 auto addMiss = [&](auto row) {
1585 auto flags =
1586 accumulatedMatchFlag_->childAt(0)->as<FlatVector<bool>>();
1587 if (!flags->valueAtFast(row)) {

Callers

nothing calls this directly

Calls 15

isAntiJoinFunction · 0.85
isLeftSemiProjectJoinFunction · 0.85
isLeftJoinFunction · 0.85
isFullJoinFunction · 0.85
isLeftSemiFilterJoinFunction · 0.85
exprMethod · 0.80
resizeFillMethod · 0.80
setValidMethod · 0.80
updateBoundsMethod · 0.80
childAtMethod · 0.80
finishIterationMethod · 0.80
has_valueMethod · 0.80

Tested by

no test coverage detected