Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2314

Employ by(String) for Map when possible and improve errors around incorrect types

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.3.9
    • Fix Version/s: 3.5.0, 3.4.5
    • Component/s: process
    • Labels:
      None

      Description

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

      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
      

      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:

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                spmallette Stephen Mallette
                Reporter:
                spmallette Stephen Mallette
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: