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

Order of select() scopes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.3
    • 3.4.0
    • process

    Description

      As it currently stands, side-effects have the highest priority when a key is select()'ed. I just ran into a problem where this behavior was more than disadvantageous:

      gremlin> g = TinkerGraph.open().traversal()
      ==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
      gremlin> g.withSideEffect("a", ["a": "marko"]).inject(1).select("a").select("a") // expected result is "marko", not "[a:marko]"
      ==>[a:marko]
      

      In my use-case the map keys were not predictable, hence it's almost impossible to prevent a key name collision. IMO maps (and paths) should take precedence over side-effects.

      It is still possible to get the nested a key, but I'm pretty sure that the common Gremlin user won't be able to come up with this query:

      gremlin> g.withSideEffect("a", ["a": "marko"]).inject(1).select("a").
                 map(unfold().filter(select(keys).is("a")).select(values))
      ==>marko
      

      Attachments

        Issue Links

          Activity

            People

              dkuppitz Daniel Kuppitz
              dkuppitz Daniel Kuppitz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: