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

Method evalAllImpl

bolt/expression/Expr.cpp:1427–2110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1425 } else if (isSpecialForm()) {
1426#else
1427 if (isSpecialForm()) {
1428#endif
1429 evalSpecialFormWithStats(rows, context, result);
1430 return;
1431 }
1432 bool tryPeelArgs = deterministic_ ? true : false;
1433 bool defaultNulls = vectorFunction_->isDefaultNullBehavior();
1434
1435 // Tracks what subset of rows shall un-evaluated inputs and current expression
1436 // evaluates. Initially points to rows.
1437 MutableRemainingRows remainingRows(rows, context);
1438 if (defaultNulls) {
1439 ScopeNegatedRelationSetter negatedSetter(
1440 context, vectorFunction_->isNegated());
1441 if (!evalArgsDefaultNulls(
1442 remainingRows,
1443 [&](auto i) {
1444 inputs_[i]->eval(remainingRows.rows(), context, inputValues_[i]);
1445 tryPeelArgs =
1446 tryPeelArgs && isPeelable(inputValues_[i]->encoding());
1447 },
1448 context,
1449 result)) {
1450 return;
1451 }
1452 } else {
1453 ScopeNegatedRelationSetter negatedSetter(
1454 context, vectorFunction_->isNegated());
1455 if (!evalArgsWithNulls(
1456 remainingRows,
1457 [&](auto i) {
1458 inputs_[i]->eval(remainingRows.rows(), context, inputValues_[i]);
1459 tryPeelArgs =
1460 tryPeelArgs && isPeelable(inputValues_[i]->encoding());
1461 },
1462 context,
1463 result)) {
1464 return;
1465 }
1466 }
1467
1468 if (!tryPeelArgs ||
1469 !applyFunctionWithPeeling(remainingRows.rows(), context, result)) {
1470 applyFunction(remainingRows.rows(), context, result);
1471 }
1472
1473 // Write non-selected rows in remainingRows as nulls in the result if some
1474 // rows have been skipped.
1475 if (remainingRows.mayHaveChanged()) {
1476 addNulls(rows, remainingRows.rows().asRange().bits(), context, result);
1477 }
1478 releaseInputValues(context);
1479}
1480
1481bool Expr::applyFunctionWithPeeling(
1482 const SelectivityVector& applyRows,
1483 EvalCtx& context,
1484 VectorPtr& result) {

Callers

nothing calls this directly

Calls 10

isPeelableFunction · 0.85
hasSelectionsMethod · 0.80
mayHaveChangedMethod · 0.80
isDefaultNullBehaviorMethod · 0.45
isNegatedMethod · 0.45
evalMethod · 0.45
rowsMethod · 0.45
encodingMethod · 0.45
bitsMethod · 0.45
asRangeMethod · 0.45

Tested by

no test coverage detected