You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2019/04/10 10:50:24 UTC

[GitHub] [tinkerpop] spmallette commented on issue #1095: Fix list deduplication for GraphSONV3d0 SetIO objectify

spmallette commented on issue #1095: Fix list deduplication for GraphSONV3d0 SetIO objectify
URL: https://github.com/apache/tinkerpop/pull/1095#issuecomment-481641161
 
 
   I had to do some more research on this. I suddenly didn't understand why the query in question:
   
   ```java
   g.V().
     project('v','edges').
     by(valueMap()).
     by(outE().valueMap().fold())
   ```
   
   from https://stackoverflow.com/q/55571767/1831717
   
   produces a `Set` for `SetIO` to be the source of this problem. So I tested the traversal in the Console:
   
   ```text
   gremlin> x = g.V().store('vertices').by(valueMap()).
   ......1>   outE().store('edges').by(valueMap()).
   ......2>   cap('vertices','edges').next()
   ==>vertices={{name=[marko], age=[29]}=1, {name=[vadas], age=[27]}=1, {name=[lop], lang=[java]}=1, {name=[josh], age=[32]}=1, {name=[ripple], lang=[java]}=1, {name=[peter], age=[35]}=1}
   ==>edges={{weight=0.4}=2, {weight=0.5}=1, {weight=1.0}=2, {weight=0.2}=1}
   gremlin> x.getClass()
   ==>class java.util.HashMap
   gremlin> x.vertices.class
   ==>class org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet
   gremlin> x.vertices[0].getClass()
   ==>class java.util.HashMap
   gremlin> x.vertices[0].age.class
   ==>class java.util.ArrayList
   ```
   
   The only collection that is `Set` based is "vertices" and "edges" keys which are `BulkSet`. The 3.3.x line of code does not have support for this `BulkSet` type - this was rectified in 3.4.0:
   
   https://github.com/apache/tinkerpop/blob/3.4.1/CHANGELOG.asciidoc#tinkerpop-340-release-date-january-2-2019
   
   So, technically the issue is resolved by 3.4.0+ but would require that you and Neptune both use this newer version.  I did come up with a workaround if to transform the `BulkSet` with Gremlin:
   
   ```text
   gremlin> x = g.V().store('vertices').by(valueMap()).
   ......1>   outE().store('edges').by(valueMap()).
   ......2>   cap('vertices','edges').
   ......3>   select('vertices','edges').
   ......4>     by(unfold().fold()).toList()
   ==>[vertices:[[name:[marko],age:[29]],[name:[vadas],age:[27]],[name:[lop],lang:[java]],[name:[josh],age:[32]],[name:[ripple],lang:[java]],[name:[peter],age:[35]]],edges:[[weight:0.4],[weight:0.4],[weight:0.5],[weight:1.0],[weight:1.0],[weight:0.2]]]
   gremlin> x.vertices.class
   ==>class java.util.ArrayList
   ```
   
   I would think that this would work on 3.3.x without any changes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services