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

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Done
    • 3.3.9
    • 3.5.0, 3.4.5
    • process
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: