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

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

Github user dkuppitz commented on the issue:

    https://github.com/apache/tinkerpop/pull/495
  
    Since this PR touches `FilterRankingStrategyTest`s, it would be nice to 
have this issue fixed as well (and have some tests added to cover this 
scenario):
    
    ```
    gremlin> g = TinkerFactory.createModern().traversal()
    ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
    gremlin> g.V(1).as("a").both().both().has("age").where(neq("a")).by("age")
    The property does not exist as the key has no associated value for the 
provided element: v[5]:age
    Type ':help' or ':h' for help.
    Display stack trace? [yN]N
    gremlin> 
g.V(1).as("a").both().both().has("age").where(neq("a")).by("age").explain()
    ==>Traversal Explanation
    
===========================================================================================================================================================================================================================================
    Original Traversal                 [GraphStep(vertex,[1])@[a], 
VertexStep(BOTH,vertex), VertexStep(BOTH,vertex), 
TraversalFilterStep([PropertiesStep([age],value)]), 
WherePredicateStep(neq(a),[value(age)])]
    ...
    FilterRankingStrategy        [O]   [GraphStep(vertex,[1])@[a], 
VertexStep(BOTH,vertex), VertexStep(BOTH,vertex), 
WherePredicateStep(neq(a),[value(age)]), 
TraversalFilterStep([PropertiesStep([age],value)])]
    ...
    Final Traversal                    [TinkerGraphStep(vertex,[1])@[a], 
VertexStep(BOTH,vertex), VertexStep(BOTH,vertex), 
WherePredicateStep(neq(a),[value(age)]), NoOpBarrierStep(2500), 
TraversalFilterStep([PropertiesStep([age],property)])]
    ```


> Chained has()-steps should simply left-append HasContainers in Gremlin-Java.
> ----------------------------------------------------------------------------
>
>                 Key: TINKERPOP-1502
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1502
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.2
>            Reporter: Marko A. Rodriguez
>
> In Gremlin-Java, {{g.V().has(a).has(b).has(c).out()}} is originally 
> represented as {{[GraphStep,HasStep(a),HasStep(b),HasStep(c),VertexStep]}}. 
> Ultimately, {{InlineFilterStrategy}} or most provider strategies will turn 
> such {{HasStep}}-chains into {{[GraphStep,HasStep(a,b,c),VertexStep]}}. That 
> is, strategies fold {{has()}}-steps "left" and delete "right" {{has()}}-steps 
> and left propagates their labels (i.e. clock cycles). I think that 
> {{GraphTraversal}} should simply do this:
> {code}
> public GraphTraversal has(whateves) {
>   if(this.getEndStep() instanceof HasStep)
>     this.getEndSte().addHasContainer(new HasContainer(whateves))
>   else
>     this.addStep(new HasStep(new HasContainer(whateves)));
>   this.bytecode.addStep("has",whateves);
>   return this;
> }
> {code}
> In essence, a "write time" optimization can be done. Given that chains of 
> {{has()}}'s is super common, this can save significant clock-cycles in the 
> long run of a production application.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to