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

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

Github user okram commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/560#discussion_r103210119
  
    --- Diff: 
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/FilterRankingStrategyTest.java
 ---
    @@ -106,7 +106,7 @@ public void doTest() {
                     {__.dedup().has("value", 0).or(not(has("age")), has("age", 
10)).has("value", 1), __.has("value", 0).has("value", 1).or(not(has("age")), 
has("age", 10)).dedup(), 
Collections.singletonList(InlineFilterStrategy.instance())},
                     {__.dedup().filter(out()).has("value", 0), has("value", 
0).filter(out()).dedup(), Collections.emptyList()},
                     {filter(out()).dedup().has("value", 0), has("value", 
0).filter(out()).dedup(), Collections.emptyList()},
    -                {__.as("a").out().has("age").where(P.eq("a")), 
__.as("a").out().where(P.eq("a")).has("age"), Collections.emptyList()},
    +                {__.as("a").out().has("age").where(P.eq("a")), 
__.as("a").out().has("age").where(P.eq("a")), Collections.emptyList()},
    --- End diff --
    
    `where(eq('a')` might be faster, but probably not. But we don't know what 
the `P` predicate is. If its something more complex, than `==` then it will be 
slower. And no, `ReferenceVertex` doesn't come into play here as those are 
resolved at "attachment" and not dynamically in mid-traversal.


> has(propertyKey) should have a corresponding step in Gremlin-Java.
> ------------------------------------------------------------------
>
>                 Key: TINKERPOP-1554
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1554
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.3
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
>
> Currently {{has('name')}} compiles to {{filter(values('name'))}}. This is bad 
> for a few reasons:
> 1. Its slower than a direct step.
> 2. Its nested traversals which increases reasoning time of strategies.
> 3. Its not clear from bytecode what it going on.
> I propose:
> {code}
> public class HasPropertyStep<S extends Element> implements FilterStep<S> {
>   private String propertyKey;
>   public boolean filter(final Traverser.Admin<S> traverser) {
>     return traverser.get().properties(propertyKey).hasNext();
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to