[ 
https://issues.apache.org/jira/browse/TINKERPOP-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16147291#comment-16147291
 ] 

ASF GitHub Bot commented on TINKERPOP-1762:
-------------------------------------------

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());
    ```


> Make MatchStep analyze mid-clause variables for executing ordering purposes.
> ----------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1762
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1762
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.2.6
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
>
> {code}
> gremlin> graph = TinkerGraph.open()
> ==>tinkergraph[vertices:0 edges:0]
> gremlin> graph.io(graphml()).readGraph("data/grateful-dead.xml")
> ==>null
> gremlin> g = graph.traversal()
> ==>graphtraversalsource[tinkergraph[vertices:808 edges:8049], standard]
> gremlin> 
> gremlin> t = g.V().match(
> ......1>         __.as("sunshine").has("song", "name", "HERE COMES SUNSHINE"),
> ......2>         
> __.as("sunshine").map(inE("followedBy").values("weight").mean()).as("avg_weight"),
> ......3>         __.as("sunshine").inE("followedBy").as("x"),
> ......4>         
> __.as("x").filter(values("weight").where(gte("avg_weight"))).outV().as("followers")
> ......5>       ).
> ......6>       select("followers").by("name"); []
> gremlin> 
> gremlin> t.clone().limit(2)
> ==>LOOKS LIKE RAIN
> ==>PROMISED LAND
> gremlin> t
> Neither the sideEffects, map, nor path has a avg_weight-key: 
> WherePredicateStep(gte(avg_weight))
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to