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

Gremlin Python doesn't support list as keys in groupCount

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.4.7
    • Fix Version/s: 3.5.0
    • Component/s: python
    • Labels:
      None

      Description

      The following works fine in the console but fails when converted to python using gremlin-server 3.4.7.

      graph = TinkerGraph.open()
      g = graph.traversal()
      g.addV('test').property(set, 'name', 'name1').property(set, 'name', 'name2')
      g.addV('test').property(set, 'name', 'name1').property(set, 'name', 'name2')
      g.addV('source').property(set, 'name', 'source')
      g.V(0L).as('0').V(3L).as('3').V(6L).as('6').addE('root').from('6').to('0').addE('root').from('6').to('3')
      g.V().has('name', 'source').out('root').groupCount().by(values('name').fold())
      ==>[[name1,name2]:2]
      

      The stack trace from python is as follows

       File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 83, in _receive
          status_code = self._protocol.data_received(data, self._results)
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/driver/protocol.py", line 83, in data_received
          message = self._message_serializer.deserialize_message(message)
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/driver/serializer.py", line 163, in deserialize_message
          return self._graphson_reader.toObject(msg)
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 129, in toObject
          return dict((self.toObject(k), self.toObject(v)) for k, v in obj.items())
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 129, in <genexpr>
          return dict((self.toObject(k), self.toObject(v)) for k, v in obj.items())
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 129, in toObject
          return dict((self.toObject(k), self.toObject(v)) for k, v in obj.items())
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 129, in <genexpr>
          return dict((self.toObject(k), self.toObject(v)) for k, v in obj.items())
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 126, in toObject
          return self.deserializers[obj[GraphSONUtil.TYPE_KEY]].objectify(obj[GraphSONUtil.VALUE_KEY], self)
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 432, in objectify
          new_list.append(reader.toObject(obj))
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 126, in toObject
          return self.deserializers[obj[GraphSONUtil.TYPE_KEY]].objectify(obj[GraphSONUtil.VALUE_KEY], self)
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 269, in objectify
          return Traverser(reader.toObject(d["value"]),
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 126, in toObject
          return self.deserializers[obj[GraphSONUtil.TYPE_KEY]].objectify(obj[GraphSONUtil.VALUE_KEY], self)
        File "/Users/connor.skennerton/.pyenv/versions/dogma/lib/python3.6/site-packages/gremlin_python/structure/io/graphsonV3d0.py", line 484, in objectify
          new_dict[reader.toObject(l[x])] = reader.toObject(l[x + 1])
      TypeError: unhashable type: 'list'
      

      Converting the list to a tuple would allow python to use these values as dictionary keys

        Attachments

          Activity

            People

            • Assignee:
              spmallette Stephen Mallette
              Reporter:
              cskennerton Connor Skennerton
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: