MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / NewProcCallOp

Function NewProcCallOp

src/execution_plan/ops/op_procedure_call.c:46–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46OpBase *NewProcCallOp
47(
48 const ExecutionPlan *plan,
49 const char *proc_name,
50 AR_ExpNode **arg_exps,
51 AR_ExpNode **yield_exps
52) {
53
54 ASSERT(plan != NULL);
55 ASSERT(proc_name != NULL);
56 ASSERT(arg_exps != NULL);
57 ASSERT(yield_exps != NULL);
58
59 OpProcCall *op = rm_malloc(sizeof(OpProcCall));
60
61 op->r = NULL;
62 op->args = array_new(SIValue, array_len(arg_exps));
63 op->arg_exps = arg_exps;
64 op->arg_count = array_len(arg_exps);
65 op->proc_name = proc_name;
66 op->yield_map = NULL;
67 op->first_call = true;
68 op->yield_exps = yield_exps;
69
70 // procedure must exist
71 op->procedure = Proc_Get(proc_name);
72 ASSERT(op->procedure != NULL);
73
74 uint yield_count = array_len(yield_exps);
75 op->output = array_new(const char *, yield_count);
76 op->yield_map = rm_malloc(sizeof(OutputMap) * yield_count);
77
78 // set callbacks
79 OpBase_Init((OpBase *)op, OPType_PROC_CALL, "ProcedureCall",
80 NULL, ProcCallConsume, ProcCallReset, NULL, ProcCallClone,
81 ProcCallFree, !Procedure_IsReadOnly(op->procedure), plan);
82
83 // set modifiers
84 for(uint i = 0; i < yield_count; i ++) {
85 const char *alias = yield_exps[i]->resolved_name;
86 const char *yield = yield_exps[i]->operand.variadic.entity_alias;
87
88 array_append(op->output, yield);
89 int rec_idx = OpBase_Modifies((OpBase *)op, alias);
90 op->yield_map[i].rec_idx = rec_idx;
91 op->yield_map[i].proc_out_idx = i;
92 }
93
94 return (OpBase *)op;
95}
96
97static Record ProcCallConsume(OpBase *opBase) {
98 OpProcCall *op = (OpProcCall *)opBase;

Callers 2

ProcCallCloneFunction · 0.85
buildCallOpFunction · 0.85

Calls 6

rm_mallocFunction · 0.85
array_lenFunction · 0.85
Proc_GetFunction · 0.85
OpBase_InitFunction · 0.85
Procedure_IsReadOnlyFunction · 0.85
OpBase_ModifiesFunction · 0.85

Tested by

no test coverage detected