tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmallette (GitHub) <git...@apache.org>
Subject [GitHub] [tinkerpop] spmallette commented on issue #1095: Fix list deduplication for GraphSONV3d0 SetIO objectify
Date Wed, 10 Apr 2019 10:50:24 GMT
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.

[ Full content available at: https://github.com/apache/tinkerpop/pull/1095 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message