Skip to content
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

pass bounded record to cartesian product branches #501

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

swilly22
Copy link
Contributor

@swilly22 swilly22 commented Nov 8, 2023

Bound variables should be available to cartesian product branches

WITH 1 AS x MATCH (a {v:x}), (b {v:x+1}) RETURN *

This PR uses the Apply and Argument operations to pass records into the cartesian-product branches.

@swilly22 swilly22 requested a review from AviAvni November 8, 2023 11:38
op->records = array_new(Record, 1);
op->rhs_branch = opBase->children[1];
op->bound_branch = opBase->children[0];

// locate branch's Argument op tap
op->op_arg = (Argument *)ExecutionPlan_LocateOp(op->rhs_branch,
op->args = array_new(Argument*, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get the op argements from the constructor
and add test for nested apply

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be wise to make this same change to all of our Apply variations e.g. OR/AND Apply Multiplexer, Semi Apply and Anti Semi Apply.

The only possible issue I see with this request is identifying the taps at compile time, there might be run-time changes which modify the Argument taps (still needs to be verified).

OpBase *rhs_branch; // right-hand branch
Argument *op_arg; // right-hand branch tap
Record r; // bound branch record
Record *records; // LHS records
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

src/execution_plan/ops/op_apply.c Show resolved Hide resolved
_ExecutionPlan_ParentReplaceChild(op->parent, op, op->children[0]);
// Add each of op's children as a child of op's parent.
for(int i = 1; i < op->childCount; i++) _OpBase_AddChild(parent, op->children[i]);
if(parent != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add doc

} else {
// Remove op from its parent.
_OpBase_RemoveChild(op->parent, op);
ASSERT(op->childCount == 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this assumption and disconnect the parent from all children

ExecutionPlan_AddOp(cp, branch);

if(bounded) {
OpBase *arg = NewArgumentOp(plan, vars);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collect this op_argumets and pass to the op_apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants