cayleygraph / cayleygraph/cayley

Remove NextPath from Iterator interface

Open
#660 1 comment 1 reaction 1 assignee Claimed by @dennwc View on GitHub
enhancement
Dominant language
Go
Stars
15.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

NextPath is one of the weird hacks that remain in Cayley from old days. It was added to make HasA iterator work properly, but in fact it can be hidden under the flag of HasA iterator.

HasA allows to either iterate over unique nodes that can be found on a specific direction of a quad, or iterate over duplicate nodes in this direction, but also "touch" other paths that can lead to this node.

It always leads to confusion in planner and query optimizer, because it cannot be quite sure if user will call one branch or the other, while backend could in theory build two optimal queries for each case.

It also getting worse when tags are defined on the query tree. It might be optimal to flip the flag on HasA to disable duplicates if no tags are defined in subtree, but again, user may decide to call NextPath anyway and break this optimization.

Splitting an iterator into two, or defining a new option for it will fix an issue and allow to properly optimize these query types. It will also lead to cleaner code.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.