Github user dkuppitz commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/701#discussion_r136081039
--- Diff:
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStep.java
---
@@ -513,8 +513,15 @@ public int hashCode() {
this.scopeKeys = new HashSet<>();
if (null != this.selectKey)
this.scopeKeys.add(this.selectKey);
- if (this.getNextStep() instanceof WhereTraversalStep ||
this.getNextStep() instanceof WherePredicateStep)
- this.scopeKeys.addAll(((Scoping)
this.getNextStep()).getScopeKeys());
+ final Set<String> endLabels = ((MatchStep<?, ?>)
this.getTraversal().getParent()).getMatchEndLabels();
+ Stream.concat(
+
TraversalHelper.getStepsOfAssignableClassRecursively(WherePredicateStep.class,
this.getTraversal()).stream(),
+
TraversalHelper.getStepsOfAssignableClassRecursively(WhereTraversalStep.class,
this.getTraversal()).stream()).
+ flatMap(s ->
s.getScopeKeys().stream()).filter(endLabels::contains).forEach(this.scopeKeys::add);
--- End diff --
Alternative solution, not using the slow streaming API:
```
TraversalHelper.anyStepRecursively(step -> {
if (step instanceof WherePredicateStep || step instanceof
WhereTraversalStep) {
for (final String key : ((Scoping) step).getScopeKeys()) {
if (endLabels.contains(key)) this.scopeKeys.add(key);
}
}
return false;
}, this.getTraversal());
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---