[ https://issues.apache.org/jira/browse/TINKERPOP-2323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17020362#comment-17020362 ]
Stephen Mallette commented on TINKERPOP-2323: --------------------------------------------- It seems you have to be explicit with the {{Bindings}} object in 3.4.x as compared to 3.3.x. That probably has to do with some stronger typing constraints in GraphBinary and such. Note the difference between 3.3.x docs: http://tinkerpop.apache.org/docs/3.3.9/reference/#_bindings and 3.4.x docs on this topic: http://tinkerpop.apache.org/docs/current/reference/#_the_lambda_solution_2 I think the other related issue was closed because it had a reasonable workaround. The complexity of bindings serialization grows if we allow them to be added arbitrarily in objects like {{P}} and for the value they provide in the context that they make sense to actually be used, I don't think we should include that complexity. I've added some tests to validate that the workaround is good on all release branches: 3.3.x - https://github.com/apache/tinkerpop/commit/0f03b032679635782ce21bedd90b9448eb3b5f72 3.4.x/3.5.x - https://github.com/apache/tinkerpop/commit/f56292b326e9ded5f064cb2a35f9edfa075c99fc > Bindings in P-arguments don't work when (de)serializing from/to bytecode > ------------------------------------------------------------------------ > > Key: TINKERPOP-2323 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2323 > Project: TinkerPop > Issue Type: Bug > Components: process, structure > Affects Versions: 3.4.4 > Environment: Windows 10, Java 1.8.0_231 > Reporter: Daniel C. Weber > Priority: Major > > The query below (a) in bytecode format represents the query > "g.V().hasLabel('Person').has('Age), gt(30))" and contains a binding as an > argument to P.gt. When sent over Websocket to Gremlin Serve 3.4.4, it leads > to the exception (b) on the server. > Furthermore, running the following query in Gremlin Console 3.4.4 suggests > that bindings are not serialized to bytecode if in a predicate: > {code} > gremlin> > g.V().has(b.of('z','person'),b.of('y','age'),P.gt(b.of('x',30))).getBytecode() > ==>[[], [V(), has(binding[z=person], binding[y=age], gt(30))]] > {code} > There's a corresponding discussion in gremlin-users: > [https://groups.google.com/forum/#!topic/gremlin-users/ltVdaxSQY1s] > There also has been a previous issue dealing with gremlinpython that was > closed as "not a problem": > https://issues.apache.org/jira/browse/TINKERPOP-1887 > (a) > {code} > { > "requestId": "c210d51a-42de-4906-b4c7-8af5d21d6024", > "op": "bytecode", > "processor": "traversal", > "args": { > "gremlin": { > "@type": "g:Bytecode", > "@value": { > "step": [ > [ > "V" > ], > [ > "hasLabel", > { > "@type": "g:Binding", > "@value": { > "value": "Person", > "key": "_a" > } > } > ], > [ > "has", > { > "@type": "g:Binding", > "@value": { > "value": "Age", > "key": "_b" > } > }, > { > "@type": "g:P", > "@value": { > "predicate": "gt", > "value": { > "@type": "g:Binding", > "@value": { > "value": { > "@type": "g:Int32", > "@value": 30 > }, > "key": "_c" > } > } > } > } > ] > ] > } > }, > "aliases": { > "g": "g" > } > } > } > {code} > > (b) > {code} > java.lang.IllegalArgumentException: Cannot compare '29' (Integer) and > 'binding[_c=30]' (Binding) as both need to be an instance of Number or > Comparable (and of the same type) > at > org.apache.tinkerpop.gremlin.process.traversal.Compare.throwException(Compare.java:193) > at > org.apache.tinkerpop.gremlin.process.traversal.Compare.access$300(Compare.java:34) > at > org.apache.tinkerpop.gremlin.process.traversal.Compare$3.test(Compare.java:96) > at org.apache.tinkerpop.gremlin.process.traversal.P.test(P.java:72) > at > org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer.testValue(HasContainer.java:118) > at > org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer.test(HasContainer.java:94) > at > org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer.testAll(HasContainer.java:180) > at > org.apache.tinkerpop.gremlin.tinkergraph.process.traversal.step.sideEffect.TinkerGraphStep.iteratorList(TinkerGraphStep.java:133) > at > org.apache.tinkerpop.gremlin.tinkergraph.process.traversal.step.sideEffect.TinkerGraphStep.vertices(TinkerGraphStep.java:101) > at > org.apache.tinkerpop.gremlin.tinkergraph.process.traversal.step.sideEffect.TinkerGraphStep.lambda$new$0(TinkerGraphStep.java:65) > at > org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:157) > at > org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) > at > org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:50) > at > org.apache.tinkerpop.gremlin.process.traversal.step.map.MapStep.processNextStart(MapStep.java:36) > at > org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143) > at > org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:197) > at > org.apache.tinkerpop.gremlin.server.util.TraverserIterator.fillBulker(TraverserIterator.java:69) > at > org.apache.tinkerpop.gremlin.server.util.TraverserIterator.hasNext(TraverserIterator.java:56) > at > org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor.handleIterator(TraversalOpProcessor.java:512) > at > org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor.lambda$iterateBytecodeTraversal$4(TraversalOpProcessor.java:411) > at java.util.concurrent.FutureTask.run(Unknown Source) > at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) > at java.util.concurrent.FutureTask.run(Unknown Source) > at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) > at java.lang.Thread.run(Unknown Source) > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)