CollectingBarrierStep bug

Anyone ever notice this bug in the CollectingBarrierStep? Offending line https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/CollectingBarrierStep.java#L81
@Override
public boolean hasNextBarrier() {
this.processAllStarts();
return !this.traverserSet.isEmpty();
}
@Override
public boolean hasNextBarrier() {
this.processAllStarts();
return !this.traverserSet.isEmpty();
}
The problem here is that if you had an input of X + Y elements where X is your collecting barrier size and Y is some number greater than 0, if the first X elements in the barrier have no results output in the barrier and the latter Y elements in the barrier do have some result, the barrier will only be called on the first X elements and will not execute a second time.
GitHub
tinkerpop/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/p...
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
Solution:
Overriding this function seems to fix ``` @Override public Traverser.Admin<Vertex> processNextStart() {...
Jump to solution
2 Replies
Lyndon
LyndonOP3mo ago
found out that is not actual the offending line. Not sure what is but the statement about barrier not executing the next section is still true actual issue seems to stem from AbstractStep @Override public boolean hasNext() { if (EmptyTraverser.instance() != this.nextEnd) return true; else { try { while (true) { if (Thread.interrupted()) throw new TraversalInterruptedException(); this.nextEnd = this.processNextStart(); if (this.nextEnd.bulk() > 0) return true; else this.nextEnd = EmptyTraverser.instance(); } } catch (final NoSuchElementException e) { return false; } } } the no such element exception is producing from the collecting barrier
Solution
Lyndon
Lyndon3mo ago
Overriding this function seems to fix
@Override
public Traverser.Admin<Vertex> processNextStart() {
try {
return super.processNextStart();
} catch (final NoSuchElementException e) {
if (!this.starts.hasNext())
throw e;
return EmptyTraverser.instance();
}
}
@Override
public Traverser.Admin<Vertex> processNextStart() {
try {
return super.processNextStart();
} catch (final NoSuchElementException e) {
if (!this.starts.hasNext())
throw e;
return EmptyTraverser.instance();
}
}
Want results from more Discord servers?
Add your server