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

Function NewDistinctOp

src/execution_plan/ops/op_distinct.c:54–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54OpBase *NewDistinctOp(const ExecutionPlan *plan, const char **aliases, uint alias_count) {
55 ASSERT(aliases != NULL);
56 ASSERT(alias_count > 0);
57
58 OpDistinct *op = rm_malloc(sizeof(OpDistinct));
59
60 op->found = raxNew();
61 op->mapping = NULL;
62 op->aliases = rm_malloc(alias_count * sizeof(const char *));
63 op->offset_count = alias_count;
64 op->offsets = rm_calloc(op->offset_count, sizeof(uint));
65
66 // Copy aliases into heap array managed by this op
67 memcpy(op->aliases, aliases, alias_count * sizeof(const char *));
68
69 OpBase_Init((OpBase *)op, OPType_DISTINCT, "Distinct", NULL, DistinctConsume,
70 DistinctReset, NULL, DistinctClone, DistinctFree, false, plan);
71
72 return (OpBase *)op;
73}
74
75static Record DistinctConsume(OpBase *opBase) {
76 OpDistinct *op = (OpDistinct *)opBase;

Callers 3

DistinctCloneFunction · 0.85
_buildProjectionOpsFunction · 0.85

Calls 3

rm_mallocFunction · 0.85
rm_callocFunction · 0.85
OpBase_InitFunction · 0.85

Tested by

no test coverage detected