tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [8/8] tinkerpop git commit: TINKERPOP-1799 Fixed serialization of Path objects for python.
Date Sat, 14 Oct 2017 10:25:35 GMT
TINKERPOP-1799 Fixed serialization of Path objects for python.

This issue only related to GraphSON 3.0 and was fairly straightforward to fix. Tests did not
pick up the failure because they continued to use GraphSON 2.0 format in the test itself.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/754be791
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/754be791
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/754be791

Branch: refs/heads/TINKERPOP-1799
Commit: 754be79112b7385f9267d1dc32267c269b7e7d17
Parents: 7407700
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Fri Oct 13 12:34:42 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Sat Oct 14 06:25:03 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 docs/src/upgrade/release-3.3.x.asciidoc                      | 8 ++++++++
 .../main/jython/gremlin_python/structure/io/graphsonV3d0.py  | 4 +---
 .../src/main/jython/tests/structure/io/test_graphsonV3d0.py  | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/754be791/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f948391..07ce7b2 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 
 This release also includes changes from <<release-3-2-7, 3.2.7>>.
 
+* Fixed bug in serialization of `Path` for GraphSON 3.0 in `gremlin-python`.
 * Added support for GraphSON 3.0 in Gremlin.Net.
 * Added `math()`-step which supports scientific calculator capabilities for numbers within
a traversal.
 * Added missing `GraphTraversalSource.addE()`-method to `GremlinDslProcessor`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/754be791/docs/src/upgrade/release-3.3.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc
index e36bdf1..80aff8b 100644
--- a/docs/src/upgrade/release-3.3.x.asciidoc
+++ b/docs/src/upgrade/release-3.3.x.asciidoc
@@ -29,6 +29,14 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.3.1/CHANGELOG.asc
 
 === Upgrading for Users
 
+==== Gremlin Python path()
+
+There was a bug in GraphSON 3.0 serialization that prevented proper handling of results contain
`Path` object. As a
+result, traversals that used and returned results from the `path()` step in Python would
return unusable results,
+but did not actually cause an exception condition. This problem is now resolved.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1799[TINKERPOP-1799]
+
 ==== Added `math()`-step for Scientific Traversal Computing
 
 `GraphTraversal.math(String)` was added. This step provides scientific calculator capabilities
to a Gremlin traversal.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/754be791/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
index 7194f48..6b5144e 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
@@ -465,6 +465,4 @@ class PathDeserializer(_GraphSONTypeIO):
 
     @classmethod
     def objectify(cls, d, reader):
-        labels = [set(label) for label in d["labels"]]
-        objects = [reader.toObject(o) for o in d["objects"]]
-        return Path(labels, objects)
+        return Path(reader.toObject(d["labels"]), reader.toObject(d["objects"]))

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/754be791/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
index b4dfcac..d04db13 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
@@ -143,7 +143,7 @@ class TestGraphSONReader(object):
 
     def test_path(self):
         path = self.graphson_reader.readObject(
-            """{"@type":"g:Path","@value":{"labels":[["a"],["b","c"],[]],"objects":[{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":0},"value":"marko","label":"name"}}],"age":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29},"label":"age"}}]}}},{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":3},"label":"software","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":4},"value":"lop","label":"name"}}],"lang":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":5},"value":"java","label":"lang"}}]}}},"lop"]}}"""
+            """{"@type":"g:Path","@value":{"labels":{"@type":"g:List","@value":[{"@type":"g:Set","@value":["a"]},{"@type":"g:Set","@value":["b","c"]},{"@type":"g:Set","@value":[]}]},"objects":{"@type":"g:List","@value":[{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":0},"value":"marko","label":"name"}}],"age":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29},"label":"age"}}]}}},{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":3},"label":"software","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":4},"value":"lop","label":"name"}}],"lang":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":5},"value":"java","label":"lang"}}]}}},"lop"]}}}"""
         )
         assert isinstance(path, Path)
         if six.PY3:


Mime
View raw message