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

Function NewProjectOp

src/execution_plan/ops/op_project.c:20–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18static void ProjectFree(OpBase *opBase);
19
20OpBase *NewProjectOp(const ExecutionPlan *plan, AR_ExpNode **exps) {
21 OpProject *op = rm_malloc(sizeof(OpProject));
22 op->exps = exps;
23 op->singleResponse = false;
24 op->exp_count = array_len(exps);
25 op->record_offsets = array_new(uint, op->exp_count);
26 op->r = NULL;
27 op->projection = NULL;
28
29 // Set our Op operations
30 OpBase_Init((OpBase *)op, OPType_PROJECT, "Project", NULL, ProjectConsume,
31 ProjectReset, NULL, ProjectClone, ProjectFree, false, plan);
32
33 for(uint i = 0; i < op->exp_count; i ++) {
34 // The projected record will associate values with their resolved name
35 // to ensure that space is allocated for each entry.
36 int record_idx = OpBase_Modifies((OpBase *)op, op->exps[i]->resolved_name);
37 array_append(op->record_offsets, record_idx);
38 }
39
40 return (OpBase *)op;
41}
42
43static Record ProjectConsume(OpBase *opBase) {
44 OpProject *op = (OpProject *)opBase;

Callers 5

ProjectCloneFunction · 0.85
_reduceNodeCountFunction · 0.85
_reduceEdgeCountFunction · 0.85
_buildProjectionOpsFunction · 0.85
_add_empty_projectionFunction · 0.85

Calls 4

rm_mallocFunction · 0.85
array_lenFunction · 0.85
OpBase_InitFunction · 0.85
OpBase_ModifiesFunction · 0.85

Tested by

no test coverage detected