"within" step combined with "or" step throws errors


Sergey Volkov <sergeym...@...>
 

We have a schema with a property of type "Long", when we try to execute simple Gremlin query in the console

g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L)))

We get the error: 

Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList

While g.V().has("prop",P.within()) can be executed just fine

Janusgraph version 0.3.2, 0.5.2

Stacktrace:
2020-08-17 11:21:41.310 -  [gremlin-server-exec-6] WARN  o.a.t.g.s.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=153f5014-2d6a-4aa9-934d-43d506cdb0c6, op='eval', processor='', args={gremlin=g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L))), bindings={}, batchSize=64}}].
org.janusgraph.core.SchemaViolationException: Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.verifyAttribute(StandardJanusGraphTx.java:578)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:267)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:257)
at org.janusgraph.graphdb.query.QueryUtil.constraints2QNF(QueryUtil.java:209)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQueryWithoutProfile(GraphCentricQueryBuilder.java:238)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQuery(GraphCentricQueryBuilder.java:225)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.buildGraphCentricQuery(JanusGraphStep.java:148)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$null$0(JanusGraphStep.java:89)
at java.base/java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$new$2(JanusGraphStep.java:89)
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.util.DefaultTraversal.hasNext(DefaultTraversal.java:197)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:93)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:264)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:278)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)


Florian Grieskamp <f.gri...@...>
 

Hi Sergey,

I just verified your problem on my machine. With JanusGraph, I get the same error as you, with TinkerGraph, the query can be executed and returns the correct result. Can you please report the error to the JanusGraph repo on GitHub?
As a quick fix, you can rewrite your query to use the following syntax:
g.V().has("prop", P.within(2L,1L))
This will work in JanusGraph and yield the same result as it is semantically identical.

Regards,
Florian

Am Montag, 17. August 2020 11:23:45 UTC+2 schrieb Sergey Volkov:

We have a schema with a property of type "Long", when we try to execute simple Gremlin query in the console

g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L)))

We get the error: 

Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList

While g.V().has("prop",P.within()) can be executed just fine

Janusgraph version 0.3.2, 0.5.2

Stacktrace:
2020-08-17 11:21:41.310 -  [gremlin-server-exec-6] WARN  o.a.t.g.s.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=153f5014-2d6a-4aa9-934d-43d506cdb0c6, op='eval', processor='', args={gremlin=g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L))), bindings={}, batchSize=64}}].
org.janusgraph.core.SchemaViolationException: Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.verifyAttribute(StandardJanusGraphTx.java:578)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:267)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:257)
at org.janusgraph.graphdb.query.QueryUtil.constraints2QNF(QueryUtil.java:209)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQueryWithoutProfile(GraphCentricQueryBuilder.java:238)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQuery(GraphCentricQueryBuilder.java:225)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.buildGraphCentricQuery(JanusGraphStep.java:148)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$null$0(JanusGraphStep.java:89)
at java.base/java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$new$2(JanusGraphStep.java:89)
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.util.DefaultTraversal.hasNext(DefaultTraversal.java:197)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:93)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:264)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:278)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)


Florian Grieskamp <f.gri...@...>
 

Hi Sergey,

I think I found the relevant snippet of code that causes the bug. Now it only needs to be eliminated and properly tested. Everybody who is concerned about the progress, please have a look at the issue on GitHub.

Am Dienstag, 18. August 2020 07:53:51 UTC+2 schrieb Florian Grieskamp:

Hi Sergey,

I just verified your problem on my machine. With JanusGraph, I get the same error as you, with TinkerGraph, the query can be executed and returns the correct result. Can you please report the error to the JanusGraph repo on GitHub?
As a quick fix, you can rewrite your query to use the following syntax:
g.V().has("prop", P.within(2L,1L))
This will work in JanusGraph and yield the same result as it is semantically identical.

Regards,
Florian

Am Montag, 17. August 2020 11:23:45 UTC+2 schrieb Sergey Volkov:
We have a schema with a property of type "Long", when we try to execute simple Gremlin query in the console

g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L)))

We get the error: 

Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList

While g.V().has("prop",P.within()) can be executed just fine

Janusgraph version 0.3.2, 0.5.2

Stacktrace:
2020-08-17 11:21:41.310 -  [gremlin-server-exec-6] WARN  o.a.t.g.s.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=153f5014-2d6a-4aa9-934d-43d506cdb0c6, op='eval', processor='', args={gremlin=g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L))), bindings={}, batchSize=64}}].
org.janusgraph.core.SchemaViolationException: Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.verifyAttribute(StandardJanusGraphTx.java:578)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:267)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:257)
at org.janusgraph.graphdb.query.QueryUtil.constraints2QNF(QueryUtil.java:209)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQueryWithoutProfile(GraphCentricQueryBuilder.java:238)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQuery(GraphCentricQueryBuilder.java:225)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.buildGraphCentricQuery(JanusGraphStep.java:148)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$null$0(JanusGraphStep.java:89)
at java.base/java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$new$2(JanusGraphStep.java:89)
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.util.DefaultTraversal.hasNext(DefaultTraversal.java:197)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:93)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:264)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:278)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)


Sergey Volkov <sergeym...@...>
 

Hi Florian,

good news, thanks

пятница, 28 августа 2020 г. в 14:43:48 UTC+2, f....@...:

Hi Sergey,

I think I found the relevant snippet of code that causes the bug. Now it only needs to be eliminated and properly tested. Everybody who is concerned about the progress, please have a look at the issue on GitHub.


Am Dienstag, 18. August 2020 07:53:51 UTC+2 schrieb Florian Grieskamp:
Hi Sergey,

I just verified your problem on my machine. With JanusGraph, I get the same error as you, with TinkerGraph, the query can be executed and returns the correct result. Can you please report the error to the JanusGraph repo on GitHub?
As a quick fix, you can rewrite your query to use the following syntax:
g.V().has("prop", P.within(2L,1L))
This will work in JanusGraph and yield the same result as it is semantically identical.

Regards,
Florian

Am Montag, 17. August 2020 11:23:45 UTC+2 schrieb Sergey Volkov:
We have a schema with a property of type "Long", when we try to execute simple Gremlin query in the console

g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L)))

We get the error: 

Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList

While g.V().has("prop",P.within()) can be executed just fine

Janusgraph version 0.3.2, 0.5.2

Stacktrace:
2020-08-17 11:21:41.310 -  [gremlin-server-exec-6] WARN  o.a.t.g.s.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=153f5014-2d6a-4aa9-934d-43d506cdb0c6, op='eval', processor='', args={gremlin=g.V().or(__.has("prop",P.within(2L)),__.has("prop",P.within(1L))), bindings={}, batchSize=64}}].
org.janusgraph.core.SchemaViolationException: Value [[2]] is not an instance of the expected data type for property key [prop] and cannot be converted. Expected: class java.lang.Long, found: class java.util.Arrays$ArrayList
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.verifyAttribute(StandardJanusGraphTx.java:578)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:267)
at org.janusgraph.graphdb.query.QueryUtil.addConstraint(QueryUtil.java:257)
at org.janusgraph.graphdb.query.QueryUtil.constraints2QNF(QueryUtil.java:209)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQueryWithoutProfile(GraphCentricQueryBuilder.java:238)
at org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.constructQuery(GraphCentricQueryBuilder.java:225)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.buildGraphCentricQuery(JanusGraphStep.java:148)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$null$0(JanusGraphStep.java:89)
at java.base/java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
at org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphStep.lambda$new$2(JanusGraphStep.java:89)
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.util.DefaultTraversal.hasNext(DefaultTraversal.java:197)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:93)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:264)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:278)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)