[ 
https://issues.apache.org/jira/browse/TINKERPOP-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephen Mallette updated TINKERPOP-2314:
----------------------------------------
    Description: 
This bit of Gremlin demonstrates both problems for uses of {{by(String)}}:

{code}
gremlin> g.V().valueMap().project('x').by('name')
java.util.LinkedHashMap cannot be cast to 
org.apache.tinkerpop.gremlin.structure.Element
Type ':help' or ':h' for help.
Display stack trace? [yN]n
{code}

First, users typically expect this to work because they figure they are just 
grabbing a keys value from a {{Map}} and then get the difficult to understand 
message which doesn't tell you how to resolve. As a side note, the way to 
resolve is with:

{code}
gremlin> g.V().valueMap().project('x').by(select('name'))
==>[x:[marko]]
==>[x:[stephen]]
==>[x:[matthias]]
==>[x:[daniel]]
==>[x:[gremlin]]
==>[x:[tinkergraph]]
{code}

  was:
This bit of Gremlin demonstrates both problems for uses of {{by(String)}}:

{code}
gremlin> g.V().values('age').project('x').by('name')
java.lang.Integer cannot be cast to 
org.apache.tinkerpop.gremlin.structure.Element
Type ':help' or ':h' for help.
Display stack trace? [yN]n
{code}

First, users typically expect this to work because they figure they are just 
grabbing a keys value from a {{Map}} and then get the difficult to understand 
message which doesn't tell you how to resolve. As a side note, the way to 
resolve is with:

{code}
gremlin> g.V().valueMap().project('x').by(select('name'))
==>[x:[marko]]
==>[x:[stephen]]
==>[x:[matthias]]
==>[x:[daniel]]
==>[x:[gremlin]]
==>[x:[tinkergraph]]
{code}


> Employ by(String) for Map when possible and improve errors around incorrect 
> types
> ---------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2314
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2314
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.3.9
>            Reporter: Stephen Mallette
>            Assignee: Stephen Mallette
>            Priority: Major
>
> This bit of Gremlin demonstrates both problems for uses of {{by(String)}}:
> {code}
> gremlin> g.V().valueMap().project('x').by('name')
> java.util.LinkedHashMap cannot be cast to 
> org.apache.tinkerpop.gremlin.structure.Element
> Type ':help' or ':h' for help.
> Display stack trace? [yN]n
> {code}
> First, users typically expect this to work because they figure they are just 
> grabbing a keys value from a {{Map}} and then get the difficult to understand 
> message which doesn't tell you how to resolve. As a side note, the way to 
> resolve is with:
> {code}
> gremlin> g.V().valueMap().project('x').by(select('name'))
> ==>[x:[marko]]
> ==>[x:[stephen]]
> ==>[x:[matthias]]
> ==>[x:[daniel]]
> ==>[x:[gremlin]]
> ==>[x:[tinkergraph]]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to