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

GroupStep's on-the-fly reducer is a bit screwy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 3.2.5
    • None
    • process
    • None

    Description

      Without dedup():

      gremlin> g.V().both().has("age").group("a").by("age").by(values("name").fold()).barrier().select("a").limit(1)
      ==>[32:[josh,josh,josh],35:[peter],27:[vadas],29:[marko,marko,marko]]
      

      With dedup():

      gremlin> g.V().both().has("age").group("a").by("age").by(values("name").dedup().fold()).barrier().select("a").limit(1)
      ==>[32:[josh:josh],35:[peter:peter],27:[vadas:vadas],29:[marko:marko]]
      

      Why do the values end up being maps? That's pretty unexpected.

      As a workaround we can do this:

      gremlin> g.withSideEffect("a", [:].withDefault {[] as Set}).V().both().has("age").group("a").by("age").by(values("name").fold()).barrier().select("a").limit(1)
      ==>[27:[vadas],32:[josh],29:[marko],35:[peter]]
      

      Also note, that cap() behaves correctly, even though we're using dedup():

      gremlin> g.V().both().has("age").group("a").by("age").by(values("name").dedup().fold()).barrier().cap("a")
      ==>[32:[josh],35:[peter],27:[vadas],29:[marko]]
      

      Attachments

        Activity

          People

            okram Marko A. Rodriguez
            dkuppitz Daniel Kuppitz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: