You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like ScalaVertex.updateWith is not correctly handling updates where the updating case class has members of type Option[T] and value None.
Here's a minimal working example:
object UpdateWithMWE extends App {
case class XYZ(x: Int, y: String, z: Option[String])
val xyz0 = XYZ(17,"foo", Some("bar"))
val xyz1 = XYZ(21,"baz", None)
val g = Neo4jGraph.open("/tmp/testdb")
val v0 = g + xyz0
println(v0.valueMap)
// prints Map(x -> 17, y -> foo, z -> bar)
v0.updateWith(xyz1)
println(v0.valueMap)
// prints Map(x -> 21, y -> baz, z -> bar, __gs -> )
}
I would expect the result of calling v0.updateWith(xyz1) to be to remove the vertex's z property, since the property can't be None or null.
This behavior is caused by the implementation of updateWith, which uses fromCC(xyz1)'s valueMap, which omits all the None members.
The text was updated successfully, but these errors were encountered:
SmedbergM
pushed a commit
to SmedbergM/gremlin-scala
that referenced
this issue
Aug 19, 2016
IIRC the implementation was done this way to preserve functional symmetry with toCC. Since toCC allows to map a graph element to different case classes, one might argue that updateWith should allow to map from different case classes. Of course, the behavior @SmedbergM described is clearly a bug.
It looks like
ScalaVertex.updateWith
is not correctly handling updates where the updating case class has members of typeOption[T]
and valueNone
.Here's a minimal working example:
I would expect the result of calling
v0.updateWith(xyz1)
to be to remove the vertex'sz
property, since the property can't beNone
ornull
.This behavior is caused by the implementation of
updateWith
, which usesfromCC(xyz1)
'svalueMap
, which omits all theNone
members.The text was updated successfully, but these errors were encountered: