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

Method evalSimplifiedImpl

bolt/expression/Expr.cpp:515–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

513}
514
515void Expr::evalSimplifiedImpl(
516 const SelectivityVector& rows,
517 EvalCtx& context,
518 VectorPtr& result) {
519 // Handle special form expressions.
520 if (isSpecialForm()) {
521 evalSpecialFormSimplified(rows, context, result);
522 return;
523 }
524
525 MutableRemainingRows remainingRows(rows, context);
526 const bool defaultNulls = vectorFunction_->isDefaultNullBehavior();
527 auto evalArg = [&](int32_t i) {
528 auto& inputValue = inputValues_[i];
529 inputs_[i]->evalSimplified(remainingRows.rows(), context, inputValue);
530 BaseVector::flattenVector(inputValue);
531 BOLT_CHECK(
532 inputValue->encoding() == VectorEncoding::Simple::FLAT ||
533 inputValue->encoding() == VectorEncoding::Simple::ARRAY ||
534 inputValue->encoding() == VectorEncoding::Simple::MAP ||
535 inputValue->encoding() == VectorEncoding::Simple::ROW ||
536 inputValue->encoding() == VectorEncoding::Simple::FUNCTION);
537 };
538
539 if (defaultNulls) {
540 if (!evalArgsDefaultNulls(remainingRows, evalArg, context, result)) {
541 return;
542 }
543 } else {
544 if (!evalArgsWithNulls(remainingRows, evalArg, context, result)) {
545 return;
546 }
547 }
548
549 // Apply the actual function.
550 try {
551 vectorFunction_->apply(
552 remainingRows.rows(), inputValues_, type(), context, result);
553 } catch (const BoltException& ve) {
554 throw;
555 } catch (const std::exception& e) {
556 BOLT_USER_FAIL(e.what());
557 }
558
559 // Make sure the returned vector has its null bitmap properly set.
560 addNulls(rows, remainingRows.rows().asRange().bits(), context, result);
561 releaseInputValues(context);
562}
563
564namespace {
565

Callers

nothing calls this directly

Calls 9

evalSimplifiedMethod · 0.80
typeEnum · 0.50
isDefaultNullBehaviorMethod · 0.45
rowsMethod · 0.45
encodingMethod · 0.45
applyMethod · 0.45
whatMethod · 0.45
bitsMethod · 0.45
asRangeMethod · 0.45

Tested by

no test coverage detected