MERGE query translation failed
sbespalov opened this issue · 2 comments
sbespalov commented
I am not much familiar with cypher, so just want to understand does below query assumed to work with cypher-for-gremlin
? The documentation tells that MERGE
statements supported, so I expect it should probably work :)
Query:
UNWIND {rows} as row MERGE (n:`ArtifactCoordinates`{uuid: row.props.uuid}) SET n=row.props RETURN row.nodeRef as ref, ID(n) as id, {type} as type
Also there is query parameters:
{type=node, rows=[{nodeRef=-1, props={path=org/carlspring/test-artifact.jar, uuid=81e6a52a-7ff2-41e4-9888-4e0b8f2135ff, version=null}}]}
This query failed within CypherAst
translation:
scala.MatchError: Property(Variable(row),PropertyKeyName(props)) (of class org.opencypher.v9_0.expressions.Property)
at org.opencypher.gremlin.translation.walker.SetWalker.asMap(SetWalker.scala:88)
at org.opencypher.gremlin.translation.walker.SetWalker.$anonfun$walkSetClause$1(SetWalker.scala:79)
at scala.collection.immutable.List.foreach(List.scala:388)
at org.opencypher.gremlin.translation.walker.SetWalker.walkSetClause(SetWalker.scala:56)
at org.opencypher.gremlin.translation.walker.SetWalker.walkClause(SetWalker.scala:45)
at org.opencypher.gremlin.translation.walker.SetWalker$.walkClause(SetWalker.scala:35)
at org.opencypher.gremlin.translation.walker.StatementWalker.walkClause(StatementWalker.scala:123)
at org.opencypher.gremlin.translation.walker.StatementWalker.$anonfun$walkSingle$1(StatementWalker.scala:84)
at org.opencypher.gremlin.translation.walker.StatementWalker.$anonfun$walkSingle$1$adapted(StatementWalker.scala:84)
at scala.collection.immutable.List.foreach(List.scala:388)
at org.opencypher.gremlin.translation.walker.StatementWalker.walkSingle(StatementWalker.scala:84)
at org.opencypher.gremlin.translation.walker.StatementWalker.walk(StatementWalker.scala:45)
at org.opencypher.gremlin.translation.walker.StatementWalker$.walk(StatementWalker.scala:32)
at org.opencypher.gremlin.translation.CypherAst.translate(CypherAst.scala:98)
at org.opencypher.gremlin.translation.CypherAst.buildTranslation(CypherAst.scala:119)
at org.opencypher.gremlin.client.InMemoryCypherGremlinClient.submitAsync(InMemoryCypherGremlinClient.java:66)
at org.opencypher.gremlin.client.CypherGremlinClient.submitAsync(CypherGremlinClient.java:231)
at org.opencypher.gremlin.client.CypherGremlinClient.submit(CypherGremlinClient.java:200)
at org.opencypher.gremlin.neo4j.driver.GremlinServerSession.run(GremlinServerSession.java:110)
at org.opencypher.gremlin.neo4j.driver.GremlinServerSession.run(GremlinServerSession.java:104)
I'll be very grateful for any help
dwitry commented
Hello @sbespalov,
MERGE
is supported, however not all "complex" cases of SET
are supported (in your example setting node properties by subproperty: n=row.props
).
If you "simplify" query a bit it should work:
UNWIND {rows} as row
MERGE (n:`ArtifactCoordinates`{uuid: row.props.uuid})
SET n.path=row.props.path,
n.uuid=row.props.uuid,
n.version=row.props.version
RETURN row.nodeRef as ref, ID(n) as id, {type} as type