You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/09/05 20:34:36 UTC

[1/2] tinkerpop git commit: TINKERPOP-2021 Added test to simulate maximum recursion depth failure

Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 e937a3a50 -> c36fc5c6b


TINKERPOP-2021 Added test to simulate maximum recursion depth failure


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

Branch: refs/heads/tp32
Commit: 425bcd032adc9967a6b575da8042df3806671825
Parents: e937a3a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Aug 28 11:58:13 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Sep 4 13:24:18 2018 -0400

----------------------------------------------------------------------
 .../src/main/jython/tests/driver/test_client.py | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/425bcd03/gremlin-python/src/main/jython/tests/driver/test_client.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_client.py b/gremlin-python/src/main/jython/tests/driver/test_client.py
index 595aba0..82b0221 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_client.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_client.py
@@ -20,6 +20,7 @@ import pytest
 
 from gremlin_python.driver.client import Client
 from gremlin_python.driver.request import RequestMessage
+from gremlin_python.process.graph_traversal import __
 from gremlin_python.structure.graph import Graph
 
 __author__ = 'David M. Brown (davebshow@gmail.com)'
@@ -107,3 +108,46 @@ def test_multi_conn_pool(client):
     # with connection pool `future` may or may not be done here
     result_set = future.result()
     assert len(result_set.all().result()) == 6
+
+
+def test_big_result_set(client):
+    g = Graph().traversal()
+    t = g.inject(1).repeat(__.addV('person').property('name', __.loops())).times(20000).count()
+    message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'g'}})
+    result_set = client.submit(message)
+    results = []
+    for result in result_set:
+        results += result
+    assert len(results) == 1
+
+    t = g.V().limit(10)
+    message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'g'}})
+    result_set = client.submit(message)
+    results = []
+    for result in result_set:
+        results += result
+    assert len(results) == 10
+
+    t = g.V().limit(100)
+    message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'g'}})
+    result_set = client.submit(message)
+    results = []
+    for result in result_set:
+        results += result
+    assert len(results) == 100
+
+    t = g.V().limit(1000)
+    message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'g'}})
+    result_set = client.submit(message)
+    results = []
+    for result in result_set:
+        results += result
+    assert len(results) == 1000
+
+    t = g.V().limit(10000)
+    message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'g'}})
+    result_set = client.submit(message)
+    results = []
+    for result in result_set:
+        results += result
+    assert len(results) == 10000


[2/2] tinkerpop git commit: TINKERPOP-1898 Fixed bug with python lambdas and strategies

Posted by sp...@apache.org.
TINKERPOP-1898 Fixed bug with python lambdas and strategies

There is a bug in jython that prevents varargs from always being called correctly. Wrapping arguments in a collection seems to solve the problem - the test that demonstrated the problem is now working. CTR


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

Branch: refs/heads/tp32
Commit: c36fc5c6bd8be2ff05c73f895980ff75374fb0c4
Parents: 425bcd0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 5 16:15:13 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 5 16:15:13 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                      |  1 +
 .../gremlin/python/jsr223/PythonTranslator.java         | 12 +++++++++++-
 .../tests/driver/test_driver_remote_connection.py       |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c36fc5c6/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index b175826..48f78e4 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * SSL security enhancements
 * Fixed problem with Gremlin Server sometimes returning an additional message after a failure.
 * Allowed spaces in classpath for `gremlin-server.bat`.
+* Fixed bug in traversals that used Python lambdas with strategies in `gremlin-python`.
 * Modified Maven archetype for Gremlin Server to use remote traversals rather than scripts.
 * Added an system error code for failed plugin installs for Gremlin Server `-i` option.
 * Match numbers in `choose()` options using `NumberHelper` (match values, ignore data type).

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c36fc5c6/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index d8c73f0..521ef4f 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -125,10 +125,20 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             else {
                 traversalScript.append(".");
                 String temp = resolveSymbol(methodName) + "(";
+
+                // jython has trouble with java varargs...wrapping in collection seems to solve the problem
+                final boolean varargsBeware = instruction.getOperator().equals(TraversalSource.Symbols.withStrategies)
+                            || instruction.getOperator().equals(TraversalSource.Symbols.withoutStrategies);
+                if (varargsBeware) temp = temp + "[";
+
                 for (final Object object : arguments) {
                     temp = temp + convertToString(object) + ",";
                 }
-                traversalScript.append(temp.substring(0, temp.length() - 1)).append(")");
+                temp = temp.substring(0, temp.length() - 1);
+
+                if (varargsBeware) temp = temp + "]";
+
+                traversalScript.append(temp).append(")");
             }
             // clip off __.
             if (this.importStatics && traversalScript.substring(0, 3).startsWith("__.")

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c36fc5c6/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index cd9101e..4d2409e 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -92,6 +92,7 @@ class TestDriverRemoteConnection(object):
         assert 4 == g.V().count().next()
         assert 0 == g.E().count().next()
         assert 1 == g.V().label().dedup().count().next()
+        assert 4 == g.V().filter(lambda: ("lambda x: True", "gremlin-python")).count().next()
         assert "person" == g.V().label().dedup().next()
         #
         g = Graph().traversal().withRemote(remote_connection). \