| 513 | } |
| 514 | |
| 515 | void 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 | |
| 564 | namespace { |
| 565 |
nothing calls this directly
no test coverage detected