Using 2.5, while traversing my graph I’m trying to keep track of the shortest path to each of many starting seeds. To do this I’m using a tuple which contains the depth of the preceding vertex and the preceding vertex. I use a MapAccum so that I can store the minimum (i.e. closest) one of these tuples for each Map key (seed vertex). What I have is something like this:
TYPEDEF TUPLE <depth Int, v Vertex> connectPred
MapAccum<Vertex, MinAccum<connectPred>> @predecessors;
result = SELECT v FROM seed:u--ANY:v
ACCUM FOREACH (k, val) IN u.@predecessors DO
v.@predecessors += (k -> connectPred(val.depth + 1, val.v))
END;
So I want to update the entries in v.@predecessors
if u.@predecessors
contains a closer predecessor vertex for the same key. However this gives me an error:
Error: No field can be accessed by 'val' of non-tuple type
However val
SHOULD be a tuple type. So this seems like a bug to me. Any workarounds? Is this fixed in recent versions? Essentially GSQL seems to not be properly handling MinAccum of tuple type.