Skip to content

TraversalHelper.onGraphComputer always returns false due to faulty logic. #2773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: 3.7-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class ComputerVerificationStrategy extends AbstractTraversalStrateg

private static final ComputerVerificationStrategy INSTANCE = new ComputerVerificationStrategy();
private static final Set<Class<?>> UNSUPPORTED_STEPS = new HashSet<>(Arrays.asList(
InjectStep.class, Mutating.class, SubgraphStep.class, ComputerResultStep.class, IoStep.class, ElementStep.class
InjectStep.class, Mutating.class, SubgraphStep.class, IoStep.class, ElementStep.class
));

// Some operators output an indeterministic result when executed in GraphComputer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,11 @@ public static boolean onGraphComputer(Traversal.Admin<?, ?> traversal) {
return true;
traversal = traversal.getParent().asStep().getTraversal();
}
return false;
if (traversal.getSteps().size() > 0) {
return traversal.getSteps().get(0) instanceof TraversalVertexProgramStep;
} else {
return false;
}
}

public static void removeAllSteps(final Traversal.Admin<?, ?> traversal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IdentityRemovalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReservedKeysVerificationStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
Expand Down Expand Up @@ -58,6 +60,7 @@
import org.apache.tinkerpop.shaded.kryo.Serializer;
import org.apache.tinkerpop.shaded.kryo.io.Input;
import org.apache.tinkerpop.shaded.kryo.io.Output;
import org.junit.Assert;
import org.junit.Test;

import java.awt.Color;
Expand Down Expand Up @@ -662,6 +665,13 @@ public void shouldProperlyTimeReducingBarrierForProfile() {
}
}

@Test
public void shouldReturnOnGraphComputerTrue() {
final GraphTraversalSource g = TinkerFactory.createModern().traversal().withComputer();
final GraphTraversal.Admin traversal = g.V().out().iterate().asAdmin();
Assert.assertTrue(TraversalHelper.onGraphComputer(traversal));
}

/**
* Just validating that property folding works nicely given TINKERPOP-2112
*/
Expand Down
Loading