[
https://issues.apache.org/jira/browse/TINKERPOP-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stephen Mallette updated TINKERPOP-2599:
----------------------------------------
Flags: (was: Important)
> Issue with the behavior of the coalesce method on the last few versions of
> gremlinpython
> ----------------------------------------------------------------------------------------
>
> Key: TINKERPOP-2599
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2599
> Project: TinkerPop
> Issue Type: Bug
> Components: python
> Affects Versions: 3.4.10, 3.4.11, 3.5.1
> Reporter: Gaxinto Theodorio
> Priority: Major
> Fix For: 3.4.9
>
>
> There's an issue with the functionality of the coalesce method in gremlin
> python. If you were to run the code below in version 3.4.9, you will find
> that the code works perfectly.
>
> {code:java}
> import os
> from gremlin_python import statics, structure
> from gremlin_python.process import graph_traversal
> from gremlin_python.structure.graph import Graph
> from gremlin_python.process.graph_traversal import __
> from gremlin_python.process.strategies import *
> from gremlin_python.driver.driver_remote_connection import
> DriverRemoteConnection
> from gremlin_python.process.traversal import T, within,
> Cardinalitygremlin_enpoint = "ws://localhost:8182/gremlin"
> graph = Graph()
> remoteConn = DriverRemoteConnection(gremlin_enpoint, "g")
> g = graph.traversal().withRemote(remoteConn)
> response = (
> g.V()
> .fold()
> .coalesce( # if exists update and get
> g.V("mark"),
> # if not exist then create
> g.addV("Person").property(Cardinality.single, T.id, "mark")
> )
> .next()
> )
> print(response)
> {code}
> However, run the same exact code in the latest version and you will be
> greeted by the following error
>
> {code:java}
> Traceback (most recent call last):
> File "<redacted>/playground/scripts/test_coalesce.py", line 18, in <module>
> g.V("test")
> File
> "<redacted>/playground-zEQSuka0/lib/python3.9/site-packages/gremlin_python/process/graph_traversal.py",
> line 217, in coalesce
> self.bytecode.add_step("coalesce", *args)
> File
> "<redacted>/playground-zEQSuka0/lib/python3.9/site-packages/gremlin_python/process/traversal.py",
> line 603, in add_step
> instruction.append(self.__convertArgument(arg))
> File
> "<redacted>/playground-zEQSuka0/lib/python3.9/site-packages/gremlin_python/process/traversal.py",
> line 629, in __convertArgument
> raise TypeError("The child traversal of " + arg + " was not spawned
> anonymously - use the __ class rather than a TraversalSource to construct the
> child traversal")
> TypeError: can only concatenate str (not "GraphTraversal") to str
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)