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

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

GitHub user dkuppitz opened a pull request:

    https://github.com/apache/incubator-tinkerpop/pull/320

    TINKERPOP-1312 .count().is(0) is not properly optimized

    Tweaked `RangeByIsCountStrategy`. The patterns ...
    
    * `....count().is(0)`
    * `....count().is(lt(1))`
    * `....count().is(lte(0))`
    
    ... are now replaced by `not(...)`.
    
    `docker/build.sh -t -i -n` succeeded.
    
    VOTE: +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1312

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-tinkerpop/pull/320.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #320
    
----
commit 5f3305315052258d3e659b1d984e87e73ad2b0af
Author: Daniel Kuppitz <[email protected]>
Date:   2016-05-25T19:13:48Z

    Tweaked `RangeByIsCountStrategy`. The pattern `outE().count().is(0)` is now 
replaced by `not(outE())`

commit 5f5a0f37221c0ca7ec777418b96429b4a20d9934
Author: Daniel Kuppitz <[email protected]>
Date:   2016-05-25T19:24:58Z

    Updated CHANGELOG

commit 5751456fcc91ea4ab9b7628e91209b96ea5d958e
Author: Daniel Kuppitz <[email protected]>
Date:   2016-05-25T19:33:44Z

    Increase step offset by 2 if `foo.count().is(0)` was replaced by `not(foo)`.

commit 3f9a256db449f0a8bbca3ca9fce8355a6dbb9a39
Author: Daniel Kuppitz <[email protected]>
Date:   2016-05-25T19:55:27Z

    Fixed the previous commit. We don't want to increase the step offset, but 
decrease the traversal size, after removing steps from a traversal.

----


> .count().is(0) is not properly optimized
> ----------------------------------------
>
>                 Key: TINKERPOP-1312
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1312
>             Project: TinkerPop
>          Issue Type: Improvement
>    Affects Versions: 3.2.0-incubating, 3.1.2-incubating
>            Reporter: Daniel Kuppitz
>            Assignee: Daniel Kuppitz
>             Fix For: 3.1.3, 3.2.1
>
>
> {{bla.count().is(0)}} gets optimized by {{RangeByIsCountStrategy}}, which 
> replaces it with {{bla.limit(1).count().is(0)}}. That's good, but we can do 
> even better by replacing it with {{__.not(bla)}}, which is a simple 
> {{.hasNext()}} instead of a {{RangeStep}} followed by a 
> {{ReducingBarrierStep}} ({{count()}}).
> Question is: should we do the replacement in {{RangeByIsCountStrategy}}? The 
> strategy will recognize the pattern, no matter if we use it for the 
> replacement or not; it's just that the strategy name is then no longer in 
> line with the the actual replacement (for this particular {{.count().is(0)}} 
> case) as it won't inject a {{RangeStep}}.



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

Reply via email to