Skip to content

Commit

Permalink
Fix execution planning of inner TRAVERSE statements
Browse files Browse the repository at this point in the history
Resolves: #8592
  • Loading branch information
luigidellaquila committed Oct 10, 2018
1 parent f26edd7 commit 28c3939
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ private boolean isStar() {
return base.toString().equals("*") && modifier == null;
}

public boolean refersToParent() {
if (base != null && base.refersToParent()) {
return true;
}
if (modifier != null && modifier.refersToParent()) {
return true;
}
return false;
}

private Object handleStar(OResult iCurrentRecord, OCommandContext ctx) {
Set<Object> result = new HashSet<>();
for (String prop : iCurrentRecord.getPropertyNames()) {
Expand Down Expand Up @@ -101,7 +111,8 @@ public OTraverseProjectionItem copy() {
return result;
}

@Override public boolean equals(Object o) {
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
Expand All @@ -117,7 +128,8 @@ public OTraverseProjectionItem copy() {
return true;
}

@Override public int hashCode() {
@Override
public int hashCode() {
int result = (base != null ? base.hashCode() : 0);
result = 31 * result + (modifier != null ? modifier.hashCode() : 0);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ public void toString(Map<Object, Object> params, StringBuilder builder) {

}

public boolean refersToParent() {
if (projections != null && projections.stream().anyMatch(x -> x.refersToParent())) {
return true;
}
if (this.target != null && this.target.refersToParent()) {
return true;
}
if (this.whileClause != null && this.whileClause.refersToParent()) {
return true;
}
return false;
}

@Override
public OStatement copy() {
OTraverseStatement result = new OTraverseStatement(-1);
Expand Down

0 comments on commit 28c3939

Please sign in to comment.