| 52 | } |
| 53 | |
| 54 | OpBase *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 | |
| 75 | static Record DistinctConsume(OpBase *opBase) { |
| 76 | OpDistinct *op = (OpDistinct *)opBase; |
no test coverage detected