opencypher / cypher-for-gremlin

Cypher for Gremlin adds Cypher support to any Gremlin graph database.
Apache License 2.0
359 stars 48 forks source link

set properties 'java.util.Date' scala.MatchError #344

Open SeaofRoses opened 4 years ago

SeaofRoses commented 4 years ago

I try to insert a map like this

String addSql="create (n :Person) SET n += $properties return n";
Map<String, Object> properties=new HashMap<String, Object>();
properties.put("date",new Date());
Map<String, Object> map=new HashMap<String, Object>();
map.put("properties",propertiesMap);
CypherResultSet resultSet = cypherGremlinClient.submit(addSql,map);
List<Map<String, Object>> list = resultSet.all();

however 'java.util.Date' type cannot be inserted

Caused by: scala.MatchError: Tue Dec 03 00:00:00 CST 2019 (of class java.util.Date)
    at org.opencypher.gremlin.translation.walker.NodeUtils$.toLiteral(NodeUtils.scala:223)
    at org.opencypher.gremlin.translation.walker.SetWalker.$anonfun$asMap$2(SetWalker.scala:98)
    at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
    at scala.collection.Iterator.foreach(Iterator.scala:937)
    at scala.collection.Iterator.foreach$(Iterator.scala:937)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
    at scala.collection.IterableLike.foreach(IterableLike.scala:70)
    at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    at scala.collection.TraversableLike.map(TraversableLike.scala:233)
    at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
    at scala.collection.AbstractTraversable.map(Traversable.scala:104)
    at org.opencypher.gremlin.translation.walker.SetWalker.asMap(SetWalker.scala:96)
    at org.opencypher.gremlin.translation.walker.SetWalker.$anonfun$walkSetClause$1(SetWalker.scala:60)
    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.GroovyCypherGremlinClient.submitAsync(GroovyCypherGremlinClient.java:68)
    at org.opencypher.gremlin.client.CypherGremlinClient.submitAsync(CypherGremlinClient.java:231)
    at org.opencypher.gremlin.client.CypherGremlinClient.submit(CypherGremlinClient.java:200)
    at )

I found that 'Java. Util. Date' was not processed in NodeUtils.toLiteral()