You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2019/11/26 12:00:22 UTC

[jira] [Closed] (TINKERPOP-2314) Employ by(String) for Map when possible and improve errors around incorrect types

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

Stephen Mallette closed TINKERPOP-2314.
---------------------------------------
    Fix Version/s: 3.4.5
                   3.5.0
       Resolution: Done

> 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
>             Fix For: 3.5.0, 3.4.5
>
>
> 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)