Merge branch 'tp32'
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/e4d0331d Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e4d0331d Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e4d0331d Branch: refs/heads/master Commit: e4d0331d86fc43eaa5f4bcad4f44126e6bd5c0be Parents: 1b9a2dc ee39d1f Author: Marko A. Rodriguez <okramma...@gmail.com> Authored: Wed Mar 1 13:43:26 2017 -0700 Committer: Marko A. Rodriguez <okramma...@gmail.com> Committed: Wed Mar 1 13:43:26 2017 -0700 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 1 + .../traversal/TraversalVertexProgram.java | 3 +- .../ComputerFinalizationStrategy.java | 62 ++++++++++++ .../process/traversal/TraversalStrategies.java | 2 + .../process/traversal/step/GraphComputing.java | 2 +- .../ComputerVerificationStrategy.java | 7 -- .../StandardVerificationStrategy.java | 5 +- .../structure/io/gryo/GryoSerializers.java | 15 ++- .../gremlin/structure/io/gryo/GryoVersion.java | 58 ++++++----- .../structure/io/gryo/UtilSerializers.java | 33 +++++- .../gremlin/python/jsr223/PythonProvider.java | 1 + .../process/traversal/step/ComplexTest.java | 101 +++++++++++++++++-- .../SparkStarBarrierInterceptor.java | 9 +- .../process/TinkerGraphNoStrategyProvider.java | 1 - 14 files changed, 245 insertions(+), 55 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4d0331d/CHANGELOG.asciidoc ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4d0331d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java ---------------------------------------------------------------------- diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java index 0690ceb,6bcb14f..27860fa --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializers.java @@@ -134,8 -136,13 +136,15 @@@ public final class GryoSerializers public final static class BytecodeSerializer implements SerializerShim<Bytecode> { @Override public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final Bytecode bytecode) { + writeInstructions(kryo, output, bytecode.getSourceInstructions()); + writeInstructions(kryo, output, bytecode.getStepInstructions()); + final List<Bytecode.Instruction> sourceInstructions = IteratorUtils.list( + IteratorUtils.filter(bytecode.getSourceInstructions().iterator(), + i -> !i.getOperator().equals(TraversalSource.Symbols.withStrategies) && + !i.getOperator().equals(TraversalSource.Symbols.withComputer))); + writeInstructions(kryo, output, sourceInstructions); + final List<Bytecode.Instruction> stepInstructions = IteratorUtils.list(bytecode.getStepInstructions().iterator()); + writeInstructions(kryo, output, stepInstructions); } @Override http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4d0331d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java ---------------------------------------------------------------------- diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java index 49bf3f4,d581559..54af562 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java @@@ -189,178 -164,6 +189,179 @@@ public enum GryoVersion return versionNumber; } + public static List<TypeRegistration<?>> initV3d0Registrations() { + return new ArrayList<TypeRegistration<?>>() {{ + add(GryoTypeReg.of(byte[].class, 25)); + add(GryoTypeReg.of(char[].class, 26)); + add(GryoTypeReg.of(short[].class, 27)); + add(GryoTypeReg.of(int[].class, 28)); + add(GryoTypeReg.of(long[].class, 29)); + add(GryoTypeReg.of(float[].class, 30)); + add(GryoTypeReg.of(double[].class, 31)); + add(GryoTypeReg.of(String[].class, 32)); + add(GryoTypeReg.of(Object[].class, 33)); + add(GryoTypeReg.of(ArrayList.class, 10)); + add(GryoTypeReg.of(Types.ARRAYS_AS_LIST, 134, new UtilSerializers.ArraysAsListSerializer())); + add(GryoTypeReg.of(BigInteger.class, 34)); + add(GryoTypeReg.of(BigDecimal.class, 35)); + add(GryoTypeReg.of(Calendar.class, 39)); + add(GryoTypeReg.of(Class.class, 41, new UtilSerializers.ClassSerializer())); ++ add(GryoTypeReg.of(Class[].class, 169, new UtilSerializers.ClassArraySerializer())); // ***LAST ID*** + add(GryoTypeReg.of(Collection.class, 37)); + add(GryoTypeReg.of(Collections.EMPTY_LIST.getClass(), 51)); + add(GryoTypeReg.of(Collections.EMPTY_MAP.getClass(), 52)); + add(GryoTypeReg.of(Collections.EMPTY_SET.getClass(), 53)); + add(GryoTypeReg.of(Collections.singleton(null).getClass(), 54)); + add(GryoTypeReg.of(Collections.singletonList(null).getClass(), 24)); + add(GryoTypeReg.of(Collections.singletonMap(null, null).getClass(), 23)); + add(GryoTypeReg.of(Contains.class, 49)); + add(GryoTypeReg.of(Currency.class, 40)); + add(GryoTypeReg.of(Date.class, 38)); + add(GryoTypeReg.of(Direction.class, 12)); + add(GryoTypeReg.of(DetachedEdge.class, 21)); + add(GryoTypeReg.of(DetachedVertexProperty.class, 20)); + add(GryoTypeReg.of(DetachedProperty.class, 18)); + add(GryoTypeReg.of(DetachedVertex.class, 19)); + add(GryoTypeReg.of(DetachedPath.class, 60)); + // skip 14 + add(GryoTypeReg.of(EnumSet.class, 46)); + add(GryoTypeReg.of(HashMap.class, 11)); + add(GryoTypeReg.of(HashMap.Entry.class, 16)); + add(GryoTypeReg.of(Types.HASH_MAP_NODE, 92)); + add(GryoTypeReg.of(KryoSerializable.class, 36)); + add(GryoTypeReg.of(LinkedHashMap.class, 47)); + add(GryoTypeReg.of(LinkedHashSet.class, 71)); + add(GryoTypeReg.of(LinkedList.class, 116)); + add(GryoTypeReg.of(Types.LINKED_HASH_MAP_ENTRY_CLASS, 15)); + add(GryoTypeReg.of(Locale.class, 22)); + add(GryoTypeReg.of(StringBuffer.class, 43)); + add(GryoTypeReg.of(StringBuilder.class, 44)); + add(GryoTypeReg.of(T.class, 48)); + add(GryoTypeReg.of(TimeZone.class, 42)); + add(GryoTypeReg.of(TreeMap.class, 45)); + add(GryoTypeReg.of(TreeSet.class, 50)); + add(GryoTypeReg.of(UUID.class, 17, new UtilSerializers.UUIDSerializer())); + add(GryoTypeReg.of(URI.class, 72, new UtilSerializers.URISerializer())); + add(GryoTypeReg.of(VertexTerminator.class, 13)); + add(GryoTypeReg.of(AbstractMap.SimpleEntry.class, 120)); + add(GryoTypeReg.of(AbstractMap.SimpleImmutableEntry.class, 121)); + add(GryoTypeReg.of(java.sql.Timestamp.class, 161)); + add(GryoTypeReg.of(InetAddress.class, 162, new UtilSerializers.InetAddressSerializer())); + add(GryoTypeReg.of(ByteBuffer.class, 163, new UtilSerializers.ByteBufferSerializer())); + + add(GryoTypeReg.of(ReferenceEdge.class, 81)); + add(GryoTypeReg.of(ReferenceVertexProperty.class, 82)); + add(GryoTypeReg.of(ReferenceProperty.class, 83)); + add(GryoTypeReg.of(ReferenceVertex.class, 84)); + add(GryoTypeReg.of(ReferencePath.class, 85)); + + add(GryoTypeReg.of(StarGraph.class, 86, new StarGraphSerializer(Direction.BOTH, new GraphFilter()))); + + add(GryoTypeReg.of(Edge.class, 65, new GryoSerializers.EdgeSerializer())); + add(GryoTypeReg.of(Vertex.class, 66, new GryoSerializers.VertexSerializer())); + add(GryoTypeReg.of(Property.class, 67, new GryoSerializers.PropertySerializer())); + add(GryoTypeReg.of(VertexProperty.class, 68, new GryoSerializers.VertexPropertySerializer())); + add(GryoTypeReg.of(Path.class, 59, new GryoSerializers.PathSerializer())); + // skip 55 + add(GryoTypeReg.of(B_O_Traverser.class, 75)); + add(GryoTypeReg.of(O_Traverser.class, 76)); + add(GryoTypeReg.of(B_LP_O_P_S_SE_SL_Traverser.class, 77)); + add(GryoTypeReg.of(B_O_S_SE_SL_Traverser.class, 78)); + add(GryoTypeReg.of(B_LP_O_S_SE_SL_Traverser.class, 87)); + add(GryoTypeReg.of(O_OB_S_SE_SL_Traverser.class, 89)); + add(GryoTypeReg.of(LP_O_OB_S_SE_SL_Traverser.class, 90)); + add(GryoTypeReg.of(LP_O_OB_P_S_SE_SL_Traverser.class, 91)); - add(GryoTypeReg.of(ProjectedTraverser.class, 168)); // ***LAST ID*** ++ add(GryoTypeReg.of(ProjectedTraverser.class, 168)); + add(GryoTypeReg.of(DefaultRemoteTraverser.class, 123, new GryoSerializers.DefaultRemoteTraverserSerializer())); + + add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializers.BytecodeSerializer())); + add(GryoTypeReg.of(P.class, 124, new GryoSerializers.PSerializer())); + add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializers.LambdaSerializer())); + add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializers.BindingSerializer())); + add(GryoTypeReg.of(Order.class, 127)); + add(GryoTypeReg.of(Scope.class, 128)); + add(GryoTypeReg.of(VertexProperty.Cardinality.class, 131)); + add(GryoTypeReg.of(Column.class, 132)); + add(GryoTypeReg.of(Pop.class, 133)); + add(GryoTypeReg.of(SackFunctions.Barrier.class, 135)); + add(GryoTypeReg.of(TraversalOptionParent.Pick.class, 137)); + add(GryoTypeReg.of(HashSetSupplier.class, 136, new UtilSerializers.HashSetSupplierSerializer())); + add(GryoTypeReg.of(MultiComparator.class, 167)); + + add(GryoTypeReg.of(ConnectiveStrategy.class, 138)); + add(GryoTypeReg.of(HaltedTraverserStrategy.class, 139)); + add(GryoTypeReg.of(PartitionStrategy.class, 140, new JavaSerializer())); + add(GryoTypeReg.of(SubgraphStrategy.class, 141, new JavaSerializer())); + add(GryoTypeReg.of(VertexProgramStrategy.class, 142, new JavaSerializer())); + add(GryoTypeReg.of(MatchAlgorithmStrategy.class, 143)); + add(GryoTypeReg.of(MatchStep.GreedyMatchAlgorithm.class, 144)); + add(GryoTypeReg.of(AdjacentToIncidentStrategy.class, 145)); + add(GryoTypeReg.of(FilterRankingStrategy.class, 146)); + add(GryoTypeReg.of(IdentityRemovalStrategy.class, 147)); + add(GryoTypeReg.of(IncidentToAdjacentStrategy.class, 148)); + add(GryoTypeReg.of(InlineFilterStrategy.class, 149)); + add(GryoTypeReg.of(LazyBarrierStrategy.class, 150)); + add(GryoTypeReg.of(MatchPredicateStrategy.class, 151)); + add(GryoTypeReg.of(OrderLimitStrategy.class, 152)); + add(GryoTypeReg.of(PathProcessorStrategy.class, 153)); + add(GryoTypeReg.of(PathRetractionStrategy.class, 154)); + add(GryoTypeReg.of(RangeByIsCountStrategy.class, 155)); + add(GryoTypeReg.of(RepeatUnrollStrategy.class, 156)); + add(GryoTypeReg.of(GraphFilterStrategy.class, 157)); + add(GryoTypeReg.of(LambdaRestrictionStrategy.class, 158)); + add(GryoTypeReg.of(ReadOnlyStrategy.class, 159)); + add(GryoTypeReg.of(MatchStep.CountMatchAlgorithm.class, 160)); + add(GryoTypeReg.of(MatchStep.GreedyMatchAlgorithm.class, 164)); + + add(GryoTypeReg.of(TraverserSet.class, 58)); + add(GryoTypeReg.of(Tree.class, 61)); + add(GryoTypeReg.of(HashSet.class, 62)); + add(GryoTypeReg.of(BulkSet.class, 64)); + add(GryoTypeReg.of(MutableMetrics.class, 69)); + add(GryoTypeReg.of(ImmutableMetrics.class, 115)); + add(GryoTypeReg.of(DefaultTraversalMetrics.class, 70)); + add(GryoTypeReg.of(MapMemory.class, 73)); + add(GryoTypeReg.of(MapReduce.NullObject.class, 74)); + add(GryoTypeReg.of(AtomicLong.class, 79)); + add(GryoTypeReg.of(Pair.class, 88, new UtilSerializers.PairSerializer())); + add(GryoTypeReg.of(TraversalExplanation.class, 106, new JavaSerializer())); + + add(GryoTypeReg.of(Duration.class, 93, new JavaTimeSerializers.DurationSerializer())); + add(GryoTypeReg.of(Instant.class, 94, new JavaTimeSerializers.InstantSerializer())); + add(GryoTypeReg.of(LocalDate.class, 95, new JavaTimeSerializers.LocalDateSerializer())); + add(GryoTypeReg.of(LocalDateTime.class, 96, new JavaTimeSerializers.LocalDateTimeSerializer())); + add(GryoTypeReg.of(LocalTime.class, 97, new JavaTimeSerializers.LocalTimeSerializer())); + add(GryoTypeReg.of(MonthDay.class, 98, new JavaTimeSerializers.MonthDaySerializer())); + add(GryoTypeReg.of(OffsetDateTime.class, 99, new JavaTimeSerializers.OffsetDateTimeSerializer())); + add(GryoTypeReg.of(OffsetTime.class, 100, new JavaTimeSerializers.OffsetTimeSerializer())); + add(GryoTypeReg.of(Period.class, 101, new JavaTimeSerializers.PeriodSerializer())); + add(GryoTypeReg.of(Year.class, 102, new JavaTimeSerializers.YearSerializer())); + add(GryoTypeReg.of(YearMonth.class, 103, new JavaTimeSerializers.YearMonthSerializer())); + add(GryoTypeReg.of(ZonedDateTime.class, 104, new JavaTimeSerializers.ZonedDateTimeSerializer())); + add(GryoTypeReg.of(ZoneOffset.class, 105, new JavaTimeSerializers.ZoneOffsetSerializer())); + + add(GryoTypeReg.of(Operator.class, 107)); + add(GryoTypeReg.of(FoldStep.FoldBiOperator.class, 108)); + add(GryoTypeReg.of(GroupCountStep.GroupCountBiOperator.class, 109)); + add(GryoTypeReg.of(GroupStep.GroupBiOperator.class, 117)); + add(GryoTypeReg.of(MeanGlobalStep.MeanGlobalBiOperator.class, 110)); + add(GryoTypeReg.of(MeanGlobalStep.MeanNumber.class, 111)); + add(GryoTypeReg.of(TreeStep.TreeBiOperator.class, 112)); + add(GryoTypeReg.of(GroupStepV3d0.GroupBiOperatorV3d0.class, 113)); + add(GryoTypeReg.of(RangeGlobalStep.RangeBiOperator.class, 114)); + add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118)); + add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119)); + + // placeholder serializers for classes that don't live here in core. this will allow them to be used if + // present or ignored if the class isn't available. either way the registration numbers are held as + // placeholders so that the format stays stable + tryAddDynamicType(this, "org.apache.tinkerpop.gremlin.driver.message.RequestMessage", + "org.apache.tinkerpop.gremlin.driver.ser.RequestMessageGryoSerializer", 165); + tryAddDynamicType(this, "org.apache.tinkerpop.gremlin.driver.message.ResponseMessage", + "org.apache.tinkerpop.gremlin.driver.ser.ResponseMessageGryoSerializer", 166); + }}; + } + public static List<TypeRegistration<?>> initV1d0Registrations() { return new ArrayList<TypeRegistration<?>>() {{ add(GryoTypeReg.of(byte[].class, 25)); @@@ -378,6 -181,7 +379,7 @@@ add(GryoTypeReg.of(BigDecimal.class, 35)); add(GryoTypeReg.of(Calendar.class, 39)); add(GryoTypeReg.of(Class.class, 41, new UtilSerializers.ClassSerializer())); - add(GryoTypeReg.of(Class[].class, 166, new UtilSerializers.ClassArraySerializer())); // ***LAST ID*** ++ add(GryoTypeReg.of(Class[].class, 166, new UtilSerializers.ClassArraySerializer())); add(GryoTypeReg.of(Collection.class, 37)); add(GryoTypeReg.of(Collections.EMPTY_LIST.getClass(), 51)); add(GryoTypeReg.of(Collections.EMPTY_MAP.getClass(), 52)); @@@ -522,6 -301,6 +499,31 @@@ add(GryoTypeReg.of(RangeGlobalStep.RangeBiOperator.class, 114)); add(GryoTypeReg.of(OrderGlobalStep.OrderBiOperator.class, 118, new JavaSerializer())); add(GryoTypeReg.of(ProfileStep.ProfileBiOperator.class, 119)); ++ ++ add(GryoTypeReg.of(ConnectiveStrategy.class, 138)); ++ add(GryoTypeReg.of(HaltedTraverserStrategy.class, 139)); ++ add(GryoTypeReg.of(PartitionStrategy.class, 140, new JavaSerializer())); ++ add(GryoTypeReg.of(SubgraphStrategy.class, 141, new JavaSerializer())); ++ add(GryoTypeReg.of(VertexProgramStrategy.class, 142, new JavaSerializer())); ++ add(GryoTypeReg.of(MatchAlgorithmStrategy.class, 143)); ++ add(GryoTypeReg.of(MatchStep.GreedyMatchAlgorithm.class, 144)); ++ add(GryoTypeReg.of(AdjacentToIncidentStrategy.class, 145)); ++ add(GryoTypeReg.of(FilterRankingStrategy.class, 146)); ++ add(GryoTypeReg.of(IdentityRemovalStrategy.class, 147)); ++ add(GryoTypeReg.of(IncidentToAdjacentStrategy.class, 148)); ++ add(GryoTypeReg.of(InlineFilterStrategy.class, 149)); ++ add(GryoTypeReg.of(LazyBarrierStrategy.class, 150)); ++ add(GryoTypeReg.of(MatchPredicateStrategy.class, 151)); ++ add(GryoTypeReg.of(OrderLimitStrategy.class, 152)); ++ add(GryoTypeReg.of(PathProcessorStrategy.class, 153)); ++ add(GryoTypeReg.of(PathRetractionStrategy.class, 154)); ++ add(GryoTypeReg.of(RangeByIsCountStrategy.class, 155)); ++ add(GryoTypeReg.of(RepeatUnrollStrategy.class, 156)); ++ add(GryoTypeReg.of(GraphFilterStrategy.class, 157)); ++ add(GryoTypeReg.of(LambdaRestrictionStrategy.class, 158)); ++ add(GryoTypeReg.of(ReadOnlyStrategy.class, 159)); ++ add(GryoTypeReg.of(MatchStep.CountMatchAlgorithm.class, 160)); ++ add(GryoTypeReg.of(MatchStep.GreedyMatchAlgorithm.class, 167)); // ***LAST ID*** }}; } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4d0331d/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java ---------------------------------------------------------------------- diff --cc gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java index 44d65fa,43e78d5..30a507e --- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java +++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java @@@ -63,10 -63,13 +63,11 @@@ public class PythonProvider extends Abs private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList( "testProfileStrategyCallback", "testProfileStrategyCallbackSideEffect", - "g_withSideEffectXa_setX_V_both_name_storeXaX_capXaX", "g_VX1X_out_injectXv2X_name", - "shouldNeverPropagateANoBulkTraverser", - "shouldNeverPropagateANullValuedTraverser", "shouldHidePartitionKeyForValues", "g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack", + "g_injectXg_VX1X_propertiesXnameX_nextX_value", + "allShortestPaths", // ProgramTest.Traversals.class.getCanonicalName(), TraversalInterruptionTest.class.getCanonicalName(), http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4d0331d/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ComplexTest.java ---------------------------------------------------------------------- diff --cc gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ComplexTest.java index f13eafc,98d19b5..bc73d57 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ComplexTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ComplexTest.java @@@ -28,8 -28,9 +28,10 @@@ import org.apache.tinkerpop.gremlin.pro import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine; import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; - import org.apache.tinkerpop.gremlin.structure.Column; + import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathRetractionStrategy; + import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy; import org.apache.tinkerpop.gremlin.structure.Vertex; ++import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@@ -39,10 -40,15 +41,15 @@@ import java.util.Collection import java.util.List; import java.util.Map; -import static java.util.Collections.emptySet; +import static java.util.Collections.emptyList; + import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN; import static org.apache.tinkerpop.gremlin.process.traversal.P.eq; + import static org.apache.tinkerpop.gremlin.process.traversal.P.lt; import static org.apache.tinkerpop.gremlin.process.traversal.P.neq; + import static org.apache.tinkerpop.gremlin.process.traversal.Pop.first; + import static org.apache.tinkerpop.gremlin.process.traversal.Pop.last; import static org.apache.tinkerpop.gremlin.process.traversal.Scope.local; + import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.both; import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.constant; import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.count; import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.group; @@@ -163,6 -174,52 +175,53 @@@ public abstract class ComplexTest exten assertFalse(traversal.hasNext()); } + @Test ++ @Ignore + @LoadGraphWith(MODERN) + public void allShortestPaths() { + final Traversal<Vertex, List<Object>> traversal = getAllShortestPaths(); + printTraversalForm(traversal); + final Object marko = convertToVertexId(graph, "marko"); + final Object vadas = convertToVertexId(graph, "vadas"); + final Object lop = convertToVertexId(graph, "lop"); + final Object josh = convertToVertexId(graph, "josh"); + final Object ripple = convertToVertexId(graph, "ripple"); + final Object peter = convertToVertexId(graph, "peter"); + final List<List<Object>> allShortestPaths = Arrays.asList( + Arrays.asList(josh, lop), + Arrays.asList(josh, marko), + Arrays.asList(josh, ripple), + Arrays.asList(josh, marko, vadas), + Arrays.asList(josh, lop, peter), + Arrays.asList(lop, marko), + Arrays.asList(lop, peter), + Arrays.asList(lop, josh), + Arrays.asList(lop, josh, ripple), + Arrays.asList(lop, marko, vadas), + Arrays.asList(marko, lop), + Arrays.asList(marko, josh), + Arrays.asList(marko, vadas), + Arrays.asList(marko, josh, ripple), + Arrays.asList(marko, lop, peter), + Arrays.asList(peter, lop), + Arrays.asList(peter, lop, marko), + Arrays.asList(peter, lop, josh), + Arrays.asList(peter, lop, josh, ripple), + Arrays.asList(peter, lop, marko, vadas), + Arrays.asList(ripple, josh), + Arrays.asList(ripple, josh, lop), + Arrays.asList(ripple, josh, marko), + Arrays.asList(ripple, josh, marko, vadas), + Arrays.asList(ripple, josh, lop, peter), + Arrays.asList(vadas, marko), + Arrays.asList(vadas, marko, josh), + Arrays.asList(vadas, marko, lop), + Arrays.asList(vadas, marko, josh, ripple), + Arrays.asList(vadas, marko, lop, peter) + ); + checkResults(allShortestPaths, traversal); + } + public static class Traversals extends ComplexTest { @Override http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e4d0331d/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java ---------------------------------------------------------------------- diff --cc spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java index 59950da,f75b845..3c74e5a --- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java +++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/traversal/strategy/optimization/interceptor/SparkStarBarrierInterceptor.java @@@ -25,7 -25,8 +25,7 @@@ import org.apache.tinkerpop.gremlin.had import org.apache.tinkerpop.gremlin.process.computer.ProgramPhase; import org.apache.tinkerpop.gremlin.process.computer.traversal.MemoryTraversalSideEffects; import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram; - import org.apache.tinkerpop.gremlin.util.NumberHelper; + import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.finalization.ComputerFinalizationStrategy; -import org.apache.tinkerpop.gremlin.process.traversal.NumberHelper; import org.apache.tinkerpop.gremlin.process.traversal.Scope; import org.apache.tinkerpop.gremlin.process.traversal.Step; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; @@@ -50,6 -51,6 +50,7 @@@ import org.apache.tinkerpop.gremlin.spa import org.apache.tinkerpop.gremlin.spark.process.computer.traversal.strategy.SparkVertexProgramInterceptor; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; ++import org.apache.tinkerpop.gremlin.util.NumberHelper; import org.apache.tinkerpop.gremlin.util.function.ArrayListSupplier; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; @@@ -85,11 -86,13 +86,11 @@@ public final class SparkStarBarrierInte .filter(vertexWritable -> ElementHelper.idExists(vertexWritable.get().id(), graphStepIds)) // ensure vertex ids are in V(x) .flatMap(vertexWritable -> { if (identityTraversal) // g.V.count()-style (identity) - return () -> IteratorUtils.of(traversal.getTraverserGenerator().generate(vertexWritable.get(), (Step) graphStep, 1l)); + return IteratorUtils.of(traversal.getTraverserGenerator().generate(vertexWritable.get(), (Step) graphStep, 1l)); else { // add the vertex to head of the traversal - return () -> { // and iterate it for its results - final Traversal.Admin<Vertex, ?> clone = traversal.clone(); // need a unique clone for each vertex to isolate the computation - clone.getStartStep().addStart(clone.getTraverserGenerator().generate(vertexWritable.get(), graphStep, 1l)); - return (Step) clone.getEndStep(); - }; + final Traversal.Admin<Vertex, ?> clone = traversal.clone(); // need a unique clone for each vertex to isolate the computation - clone.getStartStep().addStart(clone.getTraverserGenerator().generate(vertexWritable.get(), graphStep, 1l)); - return (Step) clone.getEndStep(); ++ clone.getStartStep().addStart(clone.getTraverserGenerator().generate(vertexWritable.get(), graphStep, 1l)); ++ return (Step) clone.getEndStep(); } }); // USE SPARK DSL FOR THE RESPECTIVE END REDUCING BARRIER STEP OF THE TRAVERSAL