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:28 UTC
[1/3] tinkerpop git commit: TINKERPOP-1898 Fixed bug with python
lambdas and strategies
Repository: tinkerpop
Updated Branches:
refs/heads/tp33 69bbbed7b -> 81f2292c9
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/tp33
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). \
[3/3] tinkerpop git commit: TINKERPOP-1898 Minor fix to imports after
merge from tp32 CTR
Posted by sp...@apache.org.
TINKERPOP-1898 Minor fix to imports after merge from tp32 CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/81f2292c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/81f2292c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/81f2292c
Branch: refs/heads/tp33
Commit: 81f2292c9a3c3b28a175000ec37d7d5746dcd7ab
Parents: 49c19f1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 5 16:27:34 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 5 16:27:34 2018 -0400
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/81f2292c/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 dcbfdde..0bc324e 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
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
import org.apache.tinkerpop.gremlin.process.traversal.Translator;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
[2/3] tinkerpop git commit: Merge branch 'tp32' into tp33
Posted by sp...@apache.org.
Merge branch 'tp32' into tp33
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/49c19f1b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/49c19f1b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/49c19f1b
Branch: refs/heads/tp33
Commit: 49c19f1b86c4b16406539ae3e117d3ac58190ebb
Parents: 69bbbed c36fc5c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 5 16:19:53 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 5 16:19:53 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/49c19f1b/CHANGELOG.asciidoc
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49c19f1b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------