MCPcopy Create free account
hub / github.com/apache/arrow / SimplifyIsValidGuarantee

Function SimplifyIsValidGuarantee

cpp/src/arrow/compute/expression.cc:1407–1427  ·  view source on GitHub ↗

\brief Simplify an expression given a guarantee, if the guarantee is is_valid().

Source from the content-addressed store, hash-verified

1405/// \brief Simplify an expression given a guarantee, if the guarantee
1406/// is is_valid().
1407Result<Expression> SimplifyIsValidGuarantee(Expression expr,
1408 const Expression::Call& guarantee) {
1409 if (guarantee.function_name != "is_valid") return expr;
1410
1411 return ModifyExpression(
1412 std::move(expr), [](Expression expr) { return expr; },
1413 [&](Expression expr, ...) -> Result<Expression> {
1414 auto call = expr.call();
1415 if (!call) return expr;
1416
1417 if (call->arguments[0] != guarantee.arguments[0]) return expr;
1418
1419 if (call->function_name == "is_valid") return literal(true);
1420
1421 if (call->function_name == "true_unless_null") return literal(true);
1422
1423 if (call->function_name == "is_null") return literal(false);
1424
1425 return expr;
1426 });
1427}
1428
1429} // namespace
1430

Callers

nothing calls this directly

Calls 3

ModifyExpressionFunction · 0.85
callMethod · 0.80
literalFunction · 0.70

Tested by

no test coverage detected