Nathaniel Meyer created TINKERPOP-1974:
------------------------------------------
Summary: Adding edges during VertexProgram execute with
Tinkergraph backend results in ClassCastException
Key: TINKERPOP-1974
URL: https://issues.apache.org/jira/browse/TINKERPOP-1974
Project: TinkerPop
Issue Type: Bug
Components: tinkergraph
Affects Versions: 3.3.3
Reporter: Nathaniel Meyer
Attempts to add edges during a vertex program on tinkergraph result in a
ClassCastException because
org.apache.tinkerpop.gremlin.process.computer.util.ComputerGraph.ComputerVertexcan't
be cast to having class
org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex.
In a vertex program to add edges to vertices based on rules, attempts to call
vertex.addEdge(label,otherVertex,edgeProperties) can only result in a
ClassCastException on Tinkergraph. At runtime, the Vertex argument to
VertexProgram.execute(vertex,messenger,memory) has class
org.apache.tinkerpop.gremlin.process.computer.util.ComputerGraph.ComputerVertex.
Both the vertex and the otherVertex are instances of class
ComputerGraph.ComputerVertex, but when addEdge is called on the
ComputerGraph.ComputerVertex instance, internally it calls the addEdge(...) of
the wrapped TinkerVertex. TinkerVertex.addEdge(...) casts the otherEdge to a
TinkerVertex, which it is not. There is no way to get an instance of a
TinkerVertex in a VertexProgram without specifically handling this case,
casting to ComputerGraph.ComputerVertex or WrappedVertex, and getting the
wrapped vertex of the other vertex before calling addEdge. This is not
portable across backends!
A fix might be to add handling for instances of ComputerGraph.ComputerVertex or
<C extends WrappedVertex> and get the base vertex before casting to
TinkerVertex.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)