[
https://issues.apache.org/jira/browse/TINKERPOP-1896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16386786#comment-16386786
]
Branden Moore commented on TINKERPOP-1896:
------------------------------------------
> Anyway, If a traversal has to use a lambda it should make uniform use of a
> single scripting language.
I agree completely... However, it is your suggested work-around to this issue
that leads me down the path of needing to use multiple script engines.
GremlinGroovy does not work with server-side DSLs, and python-lambdas do not
work in all cases (this issue). So I am currently back to no work-around for
this issue.
The entire reason I'm attempting to use a lambda is because Python Dictionaries
are not hashable, and thus cannot be used as keys to another dictionary. If
there is an alternate way to convert, server-side, a Map to something constant,
perhaps a string?
What I'm wanting to do is essentially:
{code:java}
g.E().hasLabel('mylabel').match(
__.as('x').outV().label().as('from'),
__.as('x').inV().label().as('to')
).select('from', 'to').groupCount(){code}
> gremlin-python lambdas error when working on Maps
> -------------------------------------------------
>
> Key: TINKERPOP-1896
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1896
> Project: TinkerPop
> Issue Type: Bug
> Components: python
> Affects Versions: 3.3.1
> Reporter: Branden Moore
> Priority: Major
> Fix For: 3.2.8, 3.3.2
>
>
> Gremlin-python lambdas throw an error on the server when the preceding step
> produces maps.
> {code}
> Traceback (most recent call last):
> File "foo.py", line 15, in <module>
> print g.V().has('name').match(__.as_('x').label().as_('lbl'),
> __.as_('x').id().as_('id')).select('lbl', 'id').map(lambda: "lambda x:
> type(x)").toList()
> File
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 52, in toList
> return list(iter(self))
> File
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 70, in next
> return self.__next__()
> File
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 43, in __next__
> self.traversal_strategies.apply_strategies(self)
> File
> "/user/.local/lib/python2.7/site-packages/gremlin_python/process/traversal.py",
> line 352, in apply_strategies
> traversal_strategy.apply(traversal)
> File
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/remote_connection.py",
> line 143, in apply
> remote_traversal = self.remote_connection.submit(traversal.bytecode)
> File
> "/user/.local/lib/python2.7/site-packages/gremlin_python/driver/driver_remote_connection.py",
> line 54, in submit
> results = result_set.all().result()
> File
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line
> 462, in result
> return self.__get_result()
> File
> "/user/.local/lib/python2.7/site-packages/concurrent/futures/_base.py", line
> 414, in __get_result
> raise exception_type, self._exception, self._traceback
> gremlin_python.driver.protocol.GremlinServerError: 599: AttributeError: type
> object 'org.apache.tinkerpop.gremlin.process.traversal.dsl' has no attribute
> 'as_' in <script> at line number 1
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)