| 13 | namespace function { |
| 14 | |
| 15 | static 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 | |
| 33 | function_set RowIDFunction::getFunctionSet() { |
| 34 | function_set functionSet; |
nothing calls this directly
no test coverage detected