Weird Error using inE()

Hey everyone,
g.V()
.hasLabel("TokenTransfer")
.has("tokenAddress", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")
.has("blockNumber", inside(0, 1000000000000))
.has("value", gt(500))
.project("label", "transactionHash", "value", "blockNumber", "from", "to")
.by('label')
.by('id')
.by(values('value'))
.by(values('blockNumber'))
.by(inE('from').outV().values('id'))
.by(inE('to').outV().values('id')).fold()
g.V()
.hasLabel("TokenTransfer")
.has("tokenAddress", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")
.has("blockNumber", inside(0, 1000000000000))
.has("value", gt(500))
.project("label", "transactionHash", "value", "blockNumber", "from", "to")
.by('label')
.by('id')
.by(values('value'))
.by(values('blockNumber'))
.by(inE('from').outV().values('id'))
.by(inE('to').outV().values('id')).fold()
I'm trying to execute this query, but when I do it, I get this error: Gremlin Query Execution Error: Project By: Next: The provided traverser of key "from" maps to nothing. I don't really get what's happening: my dataset does have 'from' and 'to' stuff going out, and a similar query works in a different context.
Solution:
glad you figured out the problem. usually those sorts of errors have to do with having no data when you expect to have some. also, note the difference between inlining your inE() and placing it inside a by() is that when you inline Gremlin just follows the edges he finds. so in cases where there is a vertex with no in edges he just stops there and that traverser is filtered away. on the other hand when Gremlin is traversing the same vertex within by(), the by() forces Gremlin to traverse...
Jump to solution
2 Replies
PedroR
PedroR2y ago
Also, using something like
g.V()
.hasLabel("TokenTransfer")
.has("tokenAddress", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")
.has("blockNumber", inside(0, 1000000000000))
.has("value", gt(500))
.inE('from').outV().values('id')
g.V()
.hasLabel("TokenTransfer")
.has("tokenAddress", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")
.has("blockNumber", inside(0, 1000000000000))
.has("value", gt(500))
.inE('from').outV().values('id')
Returns exactly what I'd expect it to. It's using it inside the projection that screws it up. Anyone think they can help? Thanks! And when I use
g.V()
.hasLabel("TokenTransfer")
.has("tokenAddress", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")
.has("blockNumber", inside(0, 1000000000000))
.has("value", gt(500))
.project("from")
.by(inE('from').outV().values('id'))
g.V()
.hasLabel("TokenTransfer")
.has("tokenAddress", "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0")
.has("blockNumber", inside(0, 1000000000000))
.has("value", gt(500))
.project("from")
.by(inE('from').outV().values('id'))
I get the same error as before! I solved it... Basically some of my nodes didn't have a 'from' edge and I just added a coalesce step
Solution
spmallette
spmallette2y ago
glad you figured out the problem. usually those sorts of errors have to do with having no data when you expect to have some. also, note the difference between inlining your inE() and placing it inside a by() is that when you inline Gremlin just follows the edges he finds. so in cases where there is a vertex with no in edges he just stops there and that traverser is filtered away. on the other hand when Gremlin is traversing the same vertex within by(), the by() forces Gremlin to traverse edges that aren't there and that's what produces your error.
Want results from more Discord servers?
Add your server