You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ke...@apache.org on 2025/10/20 05:05:56 UTC
(tinkerpop) branch TINKERPOP-3196 updated (9b8cf3e02e -> 889c4f9684)
This is an automated email from the ASF dual-hosted git repository.
kenhuuu pushed a change to branch TINKERPOP-3196
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
discard 9b8cf3e02e TINKERPOP-3196 Split bulked traversers for LocalStep
new 889c4f9684 TINKERPOP-3196 Split bulked traversers for LocalStep
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (9b8cf3e02e)
\
N -- N -- N refs/heads/TINKERPOP-3196 (889c4f9684)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../tinkerpop/gremlin/test/features/branch/Choose.feature | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(tinkerpop) 01/01: TINKERPOP-3196 Split bulked traversers for LocalStep
Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kenhuuu pushed a commit to branch TINKERPOP-3196
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 889c4f968427318e5cb43bf1ebe95c63ce91acc7
Author: Ken Hu <10...@users.noreply.github.com>
AuthorDate: Sun Oct 19 21:15:50 2025 -0700
TINKERPOP-3196 Split bulked traversers for LocalStep
Local was behaving as a per traverser traversal when it should be a per
object traversal. This means that there should be no bulked traversers
that are added as starts to local traversals.
---
.../process/traversal/step/branch/LocalStep.java | 22 +++++-
.../gremlin/test/features/branch/Choose.feature | 12 ++-
.../gremlin/test/features/branch/Local.feature | 89 +++++++++++++++++++++-
3 files changed, 115 insertions(+), 8 deletions(-)
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
index f0f08a5ee4..ba9475f784 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/LocalStep.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -38,6 +39,7 @@ public final class LocalStep<S, E> extends AbstractStep<S, E> implements Travers
private Traversal.Admin<S, E> localTraversal;
private boolean first = true;
+ private Traverser.Admin<S> currentStart = EmptyTraverser.instance();
public LocalStep(final Traversal.Admin traversal, final Traversal.Admin<S, E> localTraversal) {
super(traversal);
@@ -58,20 +60,34 @@ public final class LocalStep<S, E> extends AbstractStep<S, E> implements Travers
protected Traverser.Admin<E> processNextStart() throws NoSuchElementException {
if (this.first) {
this.first = false;
- this.localTraversal.addStart(this.starts.next());
+ this.localTraversal.addStart(nextStart());
}
while (true) {
if (this.localTraversal.hasNext())
return this.localTraversal.nextTraverser();
- else if (this.starts.hasNext()) {
+ else if (hasStartRemaining()) {
this.localTraversal.reset();
- this.localTraversal.addStart(this.starts.next());
+ this.localTraversal.addStart(nextStart());
} else {
throw FastNoSuchElementException.instance();
}
}
}
+ private boolean hasStartRemaining() {
+ return (currentStart.bulk() > 0L) || this.starts.hasNext();
+ }
+
+ private Traverser.Admin<S> nextStart() throws NoSuchElementException {
+ if (currentStart.bulk() == 0L) {
+ currentStart = starts.next();
+ }
+ final Traverser.Admin<S> split = currentStart.split();
+ split.setBulk(1L);
+ currentStart.setBulk(currentStart.bulk() - 1L);
+ return split;
+ }
+
@Override
public void reset() {
super.reset();
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Choose.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Choose.feature
index f6c24ff724..b24563b433 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Choose.feature
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Choose.feature
@@ -337,10 +337,14 @@ Feature: Step - choose()
When iterated to list
Then the result should be unordered
| result |
- | l[marko,marko] |
- | l[vadas,vadas] |
- | l[josh,josh] |
- | l[peter,peter] |
+ | l[marko] |
+ | l[marko] |
+ | l[vadas] |
+ | l[vadas] |
+ | l[josh] |
+ | l[josh] |
+ | l[peter] |
+ | l[peter] |
@GraphComputerVerificationMidVNotSupported
Scenario: g_unionXV_VXhasLabelXpersonX_barrier_mapXchooseXageX_optionXbetweenX26_30X_name_foldX_optionXnone_name_foldXX
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Local.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Local.feature
index 703e1e549e..b946d1a4a0 100644
--- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Local.feature
+++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/branch/Local.feature
@@ -183,4 +183,91 @@ Feature: Step - local()
| m[{"name":"marko","project":"lop"}] |
| m[{"name":"josh","project":"lop"}] |
| m[{"name":"peter","project":"lop"}] |
- | m[{"name":"josh","project":"ripple"}] |
\ No newline at end of file
+ | m[{"name":"josh","project":"ripple"}] |
+
+ # Barrier should show that bulked traversers don't affect local() traversal
+ Scenario: g_V_in_barrier_localXcountX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().in().barrier().local(__.count())
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+
+ # Path of traversers isn't hidden in local
+ @GraphComputerVerificationStarGraphExceeded
+ Scenario: g_V_localXout_in_simplePathX_path
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().local(__.out().in().simplePath()).path()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | p[v[josh],v[lop],v[marko]] |
+ | p[v[josh],v[lop],v[peter]] |
+ | p[v[marko],v[lop],v[josh]] |
+ | p[v[marko],v[lop],v[peter]] |
+ | p[v[peter],v[lop],v[marko]] |
+ | p[v[peter],v[lop],v[josh]] |
+
+ # Traverser's sack value should be carried over from local traversal
+ Scenario: g_withSackX0LX_V_in_barrier_localXsackXsumX_byXageXX_sack
+ Given the modern graph
+ And the traversal of
+ """
+ g.withSack(0L).V().in().barrier().local(__.sack(sum).by("age")).sack()
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | d[29].l |
+ | d[29].l |
+ | d[29].l |
+ | d[32].l |
+ | d[32].l |
+ | d[35].l |
+
+ # Nested local should return proper local count
+ Scenario: g_V_localXout_localXcountXX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().local(__.out().local(__.count()))
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+ | d[1].l |
+
+ # Local should be applied to union's global child
+ Scenario: g_V_unionXoutE_count_localXinE_countXX
+ Given the modern graph
+ And the traversal of
+ """
+ g.V().union(__.outE().count(), __.local(inE().count()))
+ """
+ When iterated to list
+ Then the result should be unordered
+ | result |
+ | d[6].l |
+ | d[0].l |
+ | d[1].l |
+ | d[3].l |
+ | d[1].l |
+ | d[1].l |
+ | d[0].l |