Skip to content

add immediate sibiling to parent op #158

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
Jan 11, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion redisgraph/execution_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ def _create_operation(args):
if op_level == level:
# if the operation level equal to the current level
# set the current operation and move next
current = _create_operation(current_op.split("|"))
child = _create_operation(current_op.split("|"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a test which will cover this case.

if current:
current = stack.pop()
current.append_child(child)
current = child
i += 1
elif op_level == level + 1:
# if the operation is child of the current operation
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,25 @@ def test_explain(self):

self.assertEqual(result.structured_plan, expected)

result = redis_graph.explain("""MATCH (r:Rider), (t:Team)
RETURN r.name, t.name""")
expected = '''\
Results
Project
Cartesian Product
Node By Label Scan | (r:Rider)
Node By Label Scan | (t:Team)'''
self.assertEqual(str(result), expected)

expected = Operation('Results') \
.append_child(Operation('Project')
.append_child(Operation('Cartesian Product')
.append_child(Operation('Node By Label Scan'))
.append_child(Operation('Node By Label Scan'))
))

self.assertEqual(result.structured_plan, expected)

redis_graph.delete()

def test_profile(self):
Expand Down