From 5b6f55dbd20703d6e2321e5c67465a1ab585b018 Mon Sep 17 00:00:00 2001 From: DvirDukhan Date: Wed, 26 Feb 2020 11:14:52 +0200 Subject: [PATCH] added op unwind clone (#988) Co-authored-by: Roi Lipman --- src/execution_plan/ops/op_unwind.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/execution_plan/ops/op_unwind.c b/src/execution_plan/ops/op_unwind.c index 07e6b9a30f..609cc3c89e 100644 --- a/src/execution_plan/ops/op_unwind.c +++ b/src/execution_plan/ops/op_unwind.c @@ -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) { @@ -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; @@ -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);