Skip to content

Commit

Permalink
added op unwind clone (RedisGraph#988)
Browse files Browse the repository at this point in the history
Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>
  • Loading branch information
DvirDukhan and swilly22 committed Feb 26, 2020
1 parent 8589ac7 commit 5b6f55d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/execution_plan/ops/op_unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
static OpResult UnwindInit(OpBase *opBase);
static Record UnwindConsume(OpBase *opBase);
static OpResult UnwindReset(OpBase *opBase);
static OpBase *UnwindClone(const ExecutionPlan *plan, const OpBase *opBase);
static void UnwindFree(OpBase *opBase);

OpBase *NewUnwindOp(const ExecutionPlan *plan, AR_ExpNode *exp) {
Expand All @@ -29,7 +30,7 @@ OpBase *NewUnwindOp(const ExecutionPlan *plan, AR_ExpNode *exp) {

// Set our Op operations
OpBase_Init((OpBase *)op, OPType_UNWIND, "Unwind", UnwindInit, UnwindConsume,
UnwindReset, NULL, NULL, UnwindFree, false, plan);
UnwindReset, NULL, UnwindClone, UnwindFree, false, plan);

op->unwindRecIdx = OpBase_Modifies((OpBase *)op, exp->resolved_name);
return (OpBase *)op;
Expand Down Expand Up @@ -114,6 +115,12 @@ static OpResult UnwindReset(OpBase *ctx) {
return OP_OK;
}

static inline OpBase *UnwindClone(const ExecutionPlan *plan, const OpBase *opBase) {
assert(opBase->type == OPType_SORT);
OpUnwind *op = (OpUnwind *)opBase;
return NewUnwindOp(plan, AR_EXP_Clone(op->exp));
}

static void UnwindFree(OpBase *ctx) {
OpUnwind *op = (OpUnwind *)ctx;
SIValue_Free(op->list);
Expand Down

0 comments on commit 5b6f55d

Please sign in to comment.