| 386 | |
| 387 | template <typename EvalArg> |
| 388 | bool Expr::evalArgsDefaultNulls( |
| 389 | MutableRemainingRows& rows, |
| 390 | EvalArg evalArg, |
| 391 | EvalCtx& context, |
| 392 | VectorPtr& result) { |
| 393 | ErrorVectorPtr argumentErrors; |
| 394 | ErrorVectorPtr originalErrors; |
| 395 | LocalDecodedVector decoded(context); |
| 396 | // Store pre-existing errors locally and clear them from |
| 397 | // 'context'. We distinguish between argument errors and |
| 398 | // pre-existing ones. |
| 399 | if (context.errors()) { |
| 400 | context.swapErrors(originalErrors); |
| 401 | } |
| 402 | |
| 403 | inputValues_.resize(inputs_.size()); |
| 404 | { |
| 405 | ScopedVarSetter throwErrors( |
| 406 | context.mutableThrowOnError(), throwArgumentErrors(context)); |
| 407 | |
| 408 | for (int32_t i = 0; i < inputs_.size(); ++i) { |
| 409 | evalArg(i); |
| 410 | const uint64_t* flatNulls = nullptr; |
| 411 | auto& arg = inputValues_[i]; |
| 412 | if (arg->mayHaveNulls()) { |
| 413 | decoded.get()->decode(*arg, rows.rows()); |
| 414 | flatNulls = decoded.get()->nulls(&rows.rows()); |
| 415 | } |
| 416 | // A null with no error deselects the row. |
| 417 | // An error adds itself to argument errors. |
| 418 | if (context.errors()) { |
| 419 | // There are new errors. |
| 420 | context.ensureErrorsVectorSize(*context.errorsPtr(), rows.rows().end()); |
| 421 | auto newErrors = context.errors(); |
| 422 | assert(newErrors); // lint |
| 423 | if (flatNulls) { |
| 424 | // There are both nulls and errors. Only a null with no error removes |
| 425 | // a row. |
| 426 | auto errorNulls = newErrors->rawNulls(); |
| 427 | auto rowBits = rows.mutableRows().asMutableRange().bits(); |
| 428 | auto nwords = bits::nwords(rows.rows().end()); |
| 429 | for (auto j = 0; j < nwords; ++j) { |
| 430 | auto nullNoError = |
| 431 | errorNulls ? flatNulls[j] | errorNulls[j] : flatNulls[j]; |
| 432 | rowBits[j] &= nullNoError; |
| 433 | } |
| 434 | rows.mutableRows().updateBounds(); |
| 435 | } |
| 436 | context.moveAppendErrors(argumentErrors); |
| 437 | } else if (flatNulls) { |
| 438 | rows.deselectNulls(flatNulls); |
| 439 | } |
| 440 | |
| 441 | if (!rows.rows().hasSelections()) { |
| 442 | break; |
| 443 | } |
| 444 | } |
| 445 | } |
nothing calls this directly
no test coverage detected