You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Marko A. Rodriguez (JIRA)" <ji...@apache.org> on 2015/10/07 22:20:27 UTC

[jira] [Comment Edited] (TINKERPOP3-844) PropertyMapStep should reuse PropertiesStep

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

Marko A. Rodriguez edited comment on TINKERPOP3-844 at 10/7/15 8:20 PM:
------------------------------------------------------------------------

Its interesting as we can do this now:

{code}
gremlin> g.V().propertyMap()
==>[name:[vp[name->marko]], age:[vp[age->29]]]
==>[name:[vp[name->vadas]], age:[vp[age->27]]]
==>[name:[vp[name->lop]], lang:[vp[lang->java]]]
==>[name:[vp[name->josh]], age:[vp[age->32]]]
==>[name:[vp[name->ripple]], lang:[vp[lang->java]]]
==>[name:[vp[name->peter]], age:[vp[age->35]]]
gremlin> g.V().map(properties().group().by(key).by())
==>[name:[vp[name->marko]], age:[vp[age->29]]]
==>[name:[vp[name->vadas]], age:[vp[age->27]]]
==>[name:[vp[name->lop]], lang:[vp[lang->java]]]
==>[name:[vp[name->josh]], age:[vp[age->32]]]
==>[name:[vp[name->ripple]], lang:[vp[lang->java]]]
==>[name:[vp[name->peter]], age:[vp[age->35]]]
{code}

However, check the problem -- 5x plus speed difference:

{code}
gremlin> clock(10000){g.V().propertyMap().next()}
==>0.014044303999999999
gremlin> clock(10000){g.V().map(properties().group().by(key).by()).next()}
==>0.0804077743
{code}

Also, there is the problem of:

{code}
gremlin> g.V().valueMap(true)
==>[name:[marko], id:1, label:person, age:[29]]
==>[name:[vadas], id:2, label:person, age:[27]]
==>[name:[lop], id:3, label:software, lang:[java]]
==>[name:[josh], id:4, label:person, age:[32]]
==>[name:[ripple], id:5, label:software, lang:[java]]
==>[name:[peter], id:6, label:person, age:[35]]
gremlin> g.V().map(properties().group().by(key).by(value))
==>[name:[marko], age:[29]]
==>[name:[vadas], age:[27]]
==>[name:[lop], lang:[java]]
==>[name:[josh], age:[32]]
==>[name:[ripple], lang:[java]]
==>[name:[peter], age:[35]]
{code}

How do we solve the {{true}} parameter where we need the id and label. ........ :/ Well, we can make a wrapping step, etc... but its ugly.


was (Author: okram):
Its interesting as we can do this now:

{code}
gremlin> g.V().propertyMap()
==>[name:[vp[name->marko]], age:[vp[age->29]]]
==>[name:[vp[name->vadas]], age:[vp[age->27]]]
==>[name:[vp[name->lop]], lang:[vp[lang->java]]]
==>[name:[vp[name->josh]], age:[vp[age->32]]]
==>[name:[vp[name->ripple]], lang:[vp[lang->java]]]
==>[name:[vp[name->peter]], age:[vp[age->35]]]
gremlin> g.V().map(properties().group().by(key).by())
==>[name:[vp[name->marko]], age:[vp[age->29]]]
==>[name:[vp[name->vadas]], age:[vp[age->27]]]
==>[name:[vp[name->lop]], lang:[vp[lang->java]]]
==>[name:[vp[name->josh]], age:[vp[age->32]]]
==>[name:[vp[name->ripple]], lang:[vp[lang->java]]]
==>[name:[vp[name->peter]], age:[vp[age->35]]]
{code}

However, check the problem -- 5x plus speed difference:

{code}
gremlin> clock(10000){g.V().propertyMap()}
==>0.0014828766
gremlin> clock(10000){g.V().map(properties().group().by(key).by())}
==>0.0082507835
{code}

Also, there is the problem of:

{code}
gremlin> g.V().valueMap(true)
==>[name:[marko], id:1, label:person, age:[29]]
==>[name:[vadas], id:2, label:person, age:[27]]
==>[name:[lop], id:3, label:software, lang:[java]]
==>[name:[josh], id:4, label:person, age:[32]]
==>[name:[ripple], id:5, label:software, lang:[java]]
==>[name:[peter], id:6, label:person, age:[35]]
gremlin> g.V().map(properties().group().by(key).by(value))
==>[name:[marko], age:[29]]
==>[name:[vadas], age:[27]]
==>[name:[lop], lang:[java]]
==>[name:[josh], age:[32]]
==>[name:[ripple], lang:[java]]
==>[name:[peter], age:[35]]
{code}

How do we solve the {{true}} parameter where we need the id and label. ........ :/ Well, we can make a wrapping step, etc... but its ugly.

> PropertyMapStep should reuse PropertiesStep
> -------------------------------------------
>
>                 Key: TINKERPOP3-844
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-844
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.1-incubating
>            Reporter: Matthias Broecheler
>            Assignee: Marko A. Rodriguez
>
> Currently, there are two steps which retrieve properties: PropertiesStep and PropertyMapStep. For any vendor implementation wishing to optimize property retrieval this means twice the (redundant) work because each of the steps needs to be extended individually.
> However, the functionality is very similar. PropertyMapStep should be replaced by two steps: PropertiesStep which returns an iterator over properties and a MapAggregatorStep (not tied to the name) which consumes properties from the previous step and builds the map (either with property or values as the the map value) until the element of a property differs.
> This reuse of PropertiesStep would have increase code reuse inside TinkerPop and should not have a significant performance impact. Most importantly, it makes life a lot easier for implementors.



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