Skip to content

add hash join op clone #989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/execution_plan/ops/op_value_hash_join.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
static OpResult ValueHashJoinInit(OpBase *opBase);
static Record ValueHashJoinConsume(OpBase *opBase);
static OpResult ValueHashJoinReset(OpBase *opBase);
static OpBase *ValueHashJoinClone(const ExecutionPlan *plan, const OpBase *opBase);
static void ValueHashJoinFree(OpBase *opBase);

/* Determins order between two records by inspecting
Expand Down Expand Up @@ -174,8 +175,8 @@ OpBase *NewValueHashJoin(const ExecutionPlan *plan, AR_ExpNode *lhs_exp, AR_ExpN

// Set our Op operations
OpBase_Init((OpBase *)op, OPType_VALUE_HASH_JOIN, "Value Hash Join", ValueHashJoinInit,
ValueHashJoinConsume, ValueHashJoinReset, ValueHashJoinToString, NULL, ValueHashJoinFree, false,
plan);
ValueHashJoinConsume, ValueHashJoinReset, ValueHashJoinToString, ValueHashJoinClone,
ValueHashJoinFree, false, plan);

op->join_value_rec_idx = OpBase_Modifies((OpBase *)op, "pivot");
return (OpBase *)op;
Expand Down Expand Up @@ -271,6 +272,12 @@ static OpResult ValueHashJoinReset(OpBase *ctx) {
return OP_OK;
}

static inline OpBase *ValueHashJoinClone(const ExecutionPlan *plan, const OpBase *opBase) {
assert(opBase->type == OPType_VALUE_HASH_JOIN);
OpValueHashJoin *op = (OpValueHashJoin *)opBase;
return NewValueHashJoin(plan, AR_EXP_Clone(op->lhs_exp), AR_EXP_Clone(op->rhs_exp));
}

/* Frees ValueHashJoin */
static void ValueHashJoinFree(OpBase *ctx) {
OpValueHashJoin *op = (OpValueHashJoin *)ctx;
Expand Down