This is an automated email from the ASF dual-hosted git repository. colegreer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit e317bdfea600840ab6b833957a1bd072c4113727 Merge: 40811d074e e39d795177 Author: Cole-Greer <[email protected]> AuthorDate: Wed Sep 17 14:39:09 2025 -0700 Merge branch '3.8-dev' .../MessagePassingReductionStrategy.java | 11 +- .../traversal/dsl/graph/GraphTraversal.java | 4 +- .../traversal/lambda/AbstractLambdaTraversal.java | 1 - .../process/traversal/step/HasContainerHolder.java | 12 +- .../{PropertyAdding.java => PropertiesHolder.java} | 8 +- .../process/traversal/step/TraversalParent.java | 2 +- .../traversal/step/filter/IsStepContract.java | 6 +- .../traversal/step/filter/IsStepPlaceholder.java | 1 + .../traversal/step/filter/RangeGlobalStep.java | 13 +- .../step/filter/RangeGlobalStepContract.java | 36 +++- .../step/filter/RangeLocalStepContract.java | 21 ++ .../step/filter/RangeStepPlaceholder.java | 53 +++-- .../step/filter/TailGlobalStepContract.java | 5 + .../step/filter/TailGlobalStepPlaceholder.java | 5 +- .../step/filter/TailLocalStepContract.java | 5 + .../step/filter/TailLocalStepPlaceholder.java | 5 +- ...er.java => AbstractAddEdgeStepPlaceholder.java} | 108 ++++++---- .../map/AbstractAddElementStepPlaceholder.java | 20 +- ....java => AbstractAddVertexStepPlaceholder.java} | 18 +- ...va => AbstractMergeElementStepPlaceholder.java} | 137 +++++-------- .../step/map/AddEdgeStartStepPlaceholder.java | 109 +---------- .../traversal/step/map/AddEdgeStepContract.java | 47 +++-- .../traversal/step/map/AddEdgeStepPlaceholder.java | 118 +---------- .../traversal/step/map/AddElementStepContract.java | 13 +- .../step/map/AddVertexStartStepPlaceholder.java | 25 +-- .../step/map/AddVertexStepPlaceholder.java | 44 +---- .../process/traversal/step/map/CallStep.java | 4 + .../traversal/step/map/CallStepContract.java | 14 +- .../traversal/step/map/CallStepPlaceholder.java | 41 ++-- .../traversal/step/map/GraphStepContract.java | 7 +- .../traversal/step/map/GraphStepPlaceholder.java | 6 +- .../step/map/MergeEdgeStepPlaceholder.java | 213 ++------------------ .../traversal/step/map/MergeStepContract.java | 45 ++++- .../step/map/MergeVertexStepPlaceholder.java | 217 +-------------------- .../traversal/step/map/VertexStepContract.java | 6 + .../traversal/step/map/VertexStepPlaceholder.java | 10 +- .../step/sideEffect/AddPropertyStepContract.java | 12 +- .../sideEffect/AddPropertyStepPlaceholder.java | 12 +- .../strategy/decoration/PartitionStrategy.java | 21 +- .../strategy/decoration/SubgraphStrategy.java | 7 +- .../optimization/AdjacentToIncidentStrategy.java | 7 +- .../optimization/IncidentToAdjacentStrategy.java | 6 +- .../strategy/optimization/LazyBarrierStrategy.java | 12 +- .../EdgeLabelVerificationStrategy.java | 12 +- .../ReservedKeysVerificationStrategy.java | 6 +- .../MessagePassingReductionStrategyTest.java | 4 +- .../traversal/step/filter/RangeGlobalStepTest.java | 6 +- .../traversal/step/filter/TailGlobalStepTest.java | 4 +- .../traversal/step/map/AddEdgeStartStepTest.java | 22 +-- .../traversal/step/map/AddEdgeStepTest.java | 26 +-- .../traversal/step/map/AddVertexStartStepTest.java | 14 +- .../traversal/step/map/AddVertexStepTest.java | 18 +- .../process/traversal/step/map/CallStepTest.java | 18 +- .../traversal/step/map/DateAddStepTest.java | 3 +- .../process/traversal/step/map/GraphStepTest.java | 6 +- .../traversal/step/map/MergeEdgeStepTest.java | 26 +-- .../traversal/step/map/MergeVertexStepTest.java | 26 +-- .../traversal/step/map/RangeLocalStepTest.java | 6 +- .../traversal/step/map/TailLocalStepTest.java | 4 +- .../process/traversal/step/map/VertexStepTest.java | 6 +- .../step/sideEffect/AddPropertyStepTest.java | 8 +- .../traversal/strategy/GValueManagerVerifier.java | 69 +------ .../strategy/GValueManagerVerifierTest.java | 17 -- .../AdjacentToIncidentStrategyTest.java | 2 +- .../strategy/optimization/CountStrategyTest.java | 8 +- .../IncidentToAdjacentStrategyTest.java | 2 +- .../optimization/LazyBarrierStrategyTest.java | 7 +- .../optimization/RepeatUnrollStrategyTest.java | 3 +- .../traversal/util/TraversalExplanationTest.java | 16 +- 69 files changed, 615 insertions(+), 1191 deletions(-) diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java index 1a51ea0685,a96a790af0..2f81ba1b3f --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/LazyBarrierStrategy.java @@@ -23,14 -23,14 +23,14 @@@ import org.apache.tinkerpop.gremlin.pro import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier; import org.apache.tinkerpop.gremlin.process.traversal.step.PathProcessor; +import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DiscardStep; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropStep; import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DiscardStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.ElementStep; import org.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep; - import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; + import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStepContract; import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep; - import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; + import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStepContract; import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep; import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep; import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy; @@@ -108,12 -108,12 +108,12 @@@ public final class LazyBarrierStrategy } if (step instanceof FlatMapStep && - !(step instanceof VertexStep && ((VertexStep) step).returnsEdge()) || - (step instanceof GraphStep && - (i > 0 || ((GraphStep) step).getIds().length >= BIG_START_SIZE || - (((GraphStep) step).getIds().length == 0 && !(step.getNextStep() instanceof HasStep))))) { + !(step instanceof VertexStepContract && ((VertexStepContract) step).returnsEdge()) || + (step instanceof GraphStepContract && + (i > 0 || ((GraphStepContract) step).getIds().length >= BIG_START_SIZE || + (((GraphStepContract) step).getIds().length == 0 && !(step.getNextStep() instanceof HasStep))))) { - // NoneStep, EmptyStep signify the end of the traversal where no barriers are really going to be + // DiscardStep, EmptyStep signify the end of the traversal where no barriers are really going to be // helpful after that. ProfileSideEffectStep means the traversal had profile() called on it and if // we don't account for that a barrier will inject at the end of the traversal where it wouldn't // be otherwise. LazyBarrierStrategy executes before the finalization strategy of ProfileStrategy diff --cc gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/RangeLocalStepTest.java index 803501085c,7ce53e1709..c0b8466b6a --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/RangeLocalStepTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/RangeLocalStepTest.java @@@ -152,50 -197,4 +152,50 @@@ public class RangeLocalStepTest extend // Test that unbounded range (high = -1) works correctly assertEquals(List.of(3, 4, 5), applyRange(List.of(1, 2, 3, 4, 5), 2, -1)); } + + @Override + protected List<Pair<Traversal, Set<String>>> getGValueTraversals() { + return List.of( + Pair.of(__.limit(Scope.local, GValue.of("limit", HIGH_VALUE)), Set.of("limit")), + Pair.of(__.skip(Scope.local, GValue.of("skip", HIGH_VALUE)), Set.of("skip")), + Pair.of(__.range(Scope.local, GValue.of(LOW_NAME, LOW_VALUE), GValue.of(HIGH_NAME, HIGH_VALUE)), Set.of(LOW_NAME, HIGH_NAME)) + ); + } + + @Test + public void getLowHighRangeNonGValue() { + GraphTraversal.Admin<Object, Object> traversal = __.range(Scope.local, LOW_VALUE, HIGH_VALUE).asAdmin(); + assertEquals((Long) LOW_VALUE, ((RangeLocalStep) traversal.getSteps().get(0)).getLowRange()); + assertEquals((Long) HIGH_VALUE, ((RangeLocalStep) traversal.getSteps().get(0)).getHighRange()); + verifyNoVariables(traversal); + } + + @Test - public void getLowHighRangeGValueSafeShouldNotPinVariables() { ++ public void getLowHighRangeAsGValueShouldNotPinVariables() { + GraphTraversal.Admin<Object, Object> traversal = __.range(Scope.local, GValue.of(LOW_NAME, LOW_VALUE), GValue.of(HIGH_NAME, HIGH_VALUE)).asAdmin(); - assertEquals(LOW_VALUE, ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).getLowRangeGValueSafe()); - assertEquals(HIGH_VALUE, ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).getHighRangeGValueSafe()); ++ assertEquals(GValue.of(LOW_NAME, LOW_VALUE), ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).getLowRangeAsGValue()); ++ assertEquals(GValue.of(HIGH_NAME, HIGH_VALUE), ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).getHighRangeAsGValue()); + verifyVariables(traversal, Set.of(), Set.of(LOW_NAME, HIGH_NAME)); + } + + @Test + public void getLowShouldPinVariable() { + GraphTraversal.Admin<Object, Object> traversal = __.range(Scope.local, GValue.of(LOW_NAME, LOW_VALUE), GValue.of(HIGH_NAME, HIGH_VALUE)).asAdmin(); + assertEquals((Long) LOW_VALUE, ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).getLowRange()); + verifyVariables(traversal, Set.of(LOW_NAME), Set.of(HIGH_NAME)); + } + + @Test + public void getHighShouldPinVariable() { + GraphTraversal.Admin<Object, Object> traversal = __.range(Scope.local, GValue.of(LOW_NAME, LOW_VALUE), GValue.of(HIGH_NAME, HIGH_VALUE)).asAdmin(); + assertEquals((Long) HIGH_VALUE, ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).getHighRange()); + verifyVariables(traversal, Set.of(HIGH_NAME), Set.of(LOW_NAME)); + } + + @Test + public void getLowHighRangeGValueFromConcreteStep() { + GraphTraversal.Admin<Object, Object> traversal = __.range(Scope.local, GValue.of(LOW_NAME, LOW_VALUE), GValue.of(HIGH_NAME, HIGH_VALUE)).asAdmin(); + assertEquals((Long) LOW_VALUE, ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).asConcreteStep().getLowRange()); + assertEquals((Long) HIGH_VALUE, ((RangeStepPlaceholder.RangeLocalStepPlaceholder) traversal.getSteps().get(0)).asConcreteStep().getHighRange()); + } } diff --cc gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/AdjacentToIncidentStrategyTest.java index 48ce34e390,e932e5d58f..44cfdad7de --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/AdjacentToIncidentStrategyTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/AdjacentToIncidentStrategyTest.java @@@ -74,8 -76,8 +74,8 @@@ public class AdjacentToIncidentStrategy @Test public void doTest() { - final String repr = translator.translate(original.getBytecode()).getScript(); + final String repr = original.getGremlinLang().getGremlin(); - GValueManagerVerifier.verify(original.asAdmin(), AdjacentToIncidentStrategy.instance()) + GValueManagerVerifier.verify(original.asAdmin(), AdjacentToIncidentStrategy.instance(), Set.of(GValueReductionStrategy.instance())) .afterApplying() .managerIsEmpty(); assertEquals(repr, optimized, original); diff --cc gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/IncidentToAdjacentStrategyTest.java index aa289f8a78,2e7917a2b6..5aeeca3e31 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/IncidentToAdjacentStrategyTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/IncidentToAdjacentStrategyTest.java @@@ -79,8 -82,8 +79,8 @@@ public class IncidentToAdjacentStrategy @Test public void doTest() { - final String repr = translator.translate(original.getBytecode()).getScript(); + final String repr = original.getGremlinLang().getGremlin("__"); - GValueManagerVerifier.verify(original.asAdmin(), IncidentToAdjacentStrategy.instance()) + GValueManagerVerifier.verify(original.asAdmin(), IncidentToAdjacentStrategy.instance(), Set.of(GValueReductionStrategy.instance())) .afterApplying() .managerIsEmpty(); assertEquals(repr, this.optimized, this.original);
