Lucene index long overflow
When I run the following code with janusgraph-inmemory and janusgraph-lucene both in version 0.6.2.
PropertiesConfiguration conf = ConfigurationUtil.loadPropertiesConfig("conf/test.properties");
JanusGraph graph = JanusGraphFactory.open(conf);
JanusGraphManagement m = graph.openManagement();
PropertyKey key = m.makePropertyKey("prop").dataType(Long.class).make();
VertexLabel label = m.makeVertexLabel("test").make();
m.buildIndex("propIndex", Vertex.class).addKey(key).indexOnly(label).buildMixedIndex("search");
m.commit();
graph.traversal()
.V()
.hasLabel("test")
.has("prop", P.neq(9223372036854775807L))
.count()
.next();
an unexpected exception is thrown:
Exception in thread "main" org.janusgraph.core.JanusGraphException: Could not execute operation due to backend exception
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:54)
at org.janusgraph.diskstorage.BackendTransaction.executeRead(BackendTransaction.java:488)
at org.janusgraph.diskstorage.BackendTransaction.indexQueryCount(BackendTransaction.java:431)
at org.janusgraph.graphdb.database.IndexSerializer.queryCount(IndexSerializer.java:603)
at org.janusgraph.graphdb.query.graph.MixedIndexCountQueryBuilder.executeTotals(MixedIndexCountQueryBuilder.java:61)
at org.janusgraph.graphdb.tinkerpop.optimize.step.JanusGraphMixedIndexCountStep.processNextStart(JanusGraphMixedIndexCountStep.java:75)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:135)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:40)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:240)
at Scratch.main(scratch.java:35)
Caused by: org.janusgraph.diskstorage.PermanentBackendException: Permanent exception while executing backend operation indexQueryCount
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:79)
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:52)
... 9 more
Caused by: java.lang.ArithmeticException: long overflow
at java.base/java.lang.Math.addExact(Math.java:848)
at org.janusgraph.diskstorage.lucene.LuceneIndex.numericQuery(LuceneIndex.java:634)
at org.janusgraph.diskstorage.lucene.LuceneIndex.convertQuery(LuceneIndex.java:766)
at org.janusgraph.diskstorage.lucene.LuceneIndex.convertQuery(LuceneIndex.java:864)
at org.janusgraph.diskstorage.lucene.LuceneIndex.queryCount(LuceneIndex.java:927)
at org.janusgraph.diskstorage.indexing.IndexTransaction.queryCount(IndexTransaction.java:114)
at org.janusgraph.diskstorage.BackendTransaction$7.call(BackendTransaction.java:434)
at org.janusgraph.diskstorage.BackendTransaction$7.call(BackendTransaction.java:431)
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:66)
... 10 more
I would expect this query to run without any problem since the constant does not overflow.