Stephen Mallette created TINKERPOP-2314:
-------------------------------------------
Summary: 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
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}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)