MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / rewriteFunc

Function rewriteFunc

src/function/pattern/rowid_function.cpp:15–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13namespace function {
14
15static std::shared_ptr<binder::Expression> rewriteFunc(const RewriteFunctionBindInput& input) {
16 DASSERT(input.arguments.size() == 1);
17 std::shared_ptr<Expression> idExpr;
18 auto param = input.arguments[0].get();
19 if (ExpressionUtil::isNodePattern(*param)) {
20 auto node = param->constPtrCast<NodeExpression>();
21 idExpr = node->getInternalID()->copy();
22 } else if (ExpressionUtil::isRelPattern(*param)) {
23 auto rel = param->constPtrCast<RelExpression>();
24 idExpr = rel->getPropertyExpression(InternalKeyword::ID)->copy();
25 } else {
26 auto extractKey = input.expressionBinder->createLiteralExpression(InternalKeyword::ID);
27 idExpr = input.expressionBinder->bindScalarFunctionExpression(
28 {input.arguments[0], extractKey}, StructExtractFunctions::name);
29 }
30 return input.expressionBinder->bindScalarFunctionExpression({idExpr}, OffsetFunction::name);
31}
32
33function_set RowIDFunction::getFunctionSet() {
34 function_set functionSet;

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.45
getMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected