Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Titandb - scala map doesn't persist #14

Open
sheshmantha opened this issue Feb 11, 2016 · 2 comments
Open

Titandb - scala map doesn't persist #14

sheshmantha opened this issue Feb 11, 2016 · 2 comments

Comments

@sheshmantha
Copy link

hi,
I've got a case class that has a scala Map. When I persist it in tinkergraph it works fine. When I persist in Titan, I get an error java.lang.IllegalArgumentException: Property value [Map(blah -> blah)] is of type class scala.collection.immutable.Map$Map1 is not supported.

Here is a spec for reproducing it using the InMemoryConnect.

@label("flight")
case class Flight(carrier: String, number: String)`

@label("segment")
case class Segment(duration: Int, origin: String, destination: String, data: Option[Map[String,String]])

with the following added to SimpleSpec.scala

"Gremlin-Scala in Titan" should "serialize nested class as properties" in {

    val graph = connect().asScala
    val flight = Flight("AA", "123")
    val seg = Segment(12, "ORD", "BOS", Some(Map("blah" -> "blah-blah")))
    val flightVertex = graph + flight // addVertex(flight)
    val segVertex = graph + seg

    flightVertex <-- "has" --- segVertex
    flightVertex --- "belongsTo" --> segVertex
    flightVertex.out("belongsTo").head() shouldBe segVertex
    graph.V(segVertex.id).out("has").head shouldBe flightVertex
    graph.close
  }

Do I need a marshaller ?

@sheshmantha
Copy link
Author

I also tried the "use @label and @id annotations" from Marshallable.spec of gremlin-scala w/w/o the @id annotation and the Map definitely fails in same manner.

Property value [Map(key1 -> value1, key2 -> value2)] is of type class scala.collection.immutable.Map$Map2 is not supported
java.lang.IllegalArgumentException: Property value [Map(key1 -> value1, key2 -> value2)] is of type class scala.collection.immutable.Map$Map2 is not supported
    at org.apache.tinkerpop.gremlin.structure.Property$Exceptions.dataTypeOfPropertyValueNotSupported(Property.java:159)
    at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.verifyAttribute(StandardTitanTx.java:564)
    at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:716)
    at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:706)
    at com.thinkaurelius.titan.graphdb.vertices.AbstractVertex.property(AbstractVertex.java:135)
    at com.thinkaurelius.titan.core.TitanVertex.property(TitanVertex.java:58)
    at com.thinkaurelius.titan.graphdb.util.ElementHelper.attachProperties(ElementHelper.java:66)
    at com.thinkaurelius.titan.graphdb.tinkerpop.TitanBlueprintsTransaction.addVertex(TitanBlueprintsTransaction.java:110)
    at com.thinkaurelius.titan.graphdb.tinkerpop.TitanBlueprintsGraph.addVertex(TitanBlueprintsGraph.java:115)
    at com.thinkaurelius.titan.graphdb.tinkerpop.TitanBlueprintsGraph.addVertex(TitanBlueprintsGraph.java:33)
    at gremlin.scala.ScalaGraph.addVertex(ScalaGraph.scala:43)
    at gremlin.scala.ScalaGraph.$plus(ScalaGraph.scala:46)
    at SimpleSpec$$anonfun$3.apply$mcV$sp(SimpleSpec.scala:76)

@sheshmantha
Copy link
Author

oops -- sorry -- recognized that it's Titan and that I need a Serializer... researching. will post answer when I find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant