orientechnologies / orientdb-gremlin

TinkerPop3 Graph Structure Implementation for OrientDB
Apache License 2.0
93 stars 32 forks source link

Composite index lookup #110

Open jCalamari opened 7 years ago

jCalamari commented 7 years ago

Hello guys,

thank you for great work on integrating Gremlin with OrientDB! Any ideas when orientdb-gremlin will support Composite index query?

Give a composite index:

CREATE INDEX simple_composit_index ON Edge (from, to) UNIQUE

Following query failes:

graph.E.hasLabel("Edge").has(Key[String]("from"), fromValue).has(Key[String]("to"), toValue)

With message:

Impossible add as key of a CompositeIndex a value of type class java.lang.String

Stacktrace:

at com.orientechnologies.orient.core.index.OCompositeCollate.transform(OCompositeCollate.java:62) ~[orientdb-core-2.2.8.jar:2.2.8] at com.orientechnologies.orient.core.index.OIndexAbstract.getCollatingValue(OIndexAbstract.java:919) ~[orientdb-core-2.2.8.jar:2.2.8] at com.orientechnologies.orient.core.index.OIndexOneValue.get(OIndexOneValue.java:47) ~[orientdb-core-2.2.8.jar:2.2.8] at com.orientechnologies.orient.core.index.OIndexOneValue.get(OIndexOneValue.java:40) ~[orientdb-core-2.2.8.jar:2.2.8] at com.orientechnologies.orient.core.index.OIndexAbstractDelegate.get(OIndexAbstractDelegate.java:58) ~[orientdb-core-2.2.8.jar:2.2.8] at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.get(OIndexTxAwareOneValue.java:261) ~[orientdb-core-2.2.8.jar:2.2.8] at com.orientechnologies.orient.core.index.OIndexTxAwareOneValue.get(OIndexTxAwareOneValue.java:41) ~[orientdb-core-2.2.8.jar:2.2.8] at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lookupInIndex(OrientGraph.java:295) ~[orientdb-gremlin-3.2.1.1.jar:?] at org.apache.tinkerpop.gremlin.orientdb.OrientGraph.lambda$null$7(OrientGraph.java:286) ~[orientdb-gremlin-3.2.1.1.jar:?] at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) ~[?:1.8.0_60] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_60] at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_60] at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:1.8.0_60] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_60] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_60] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_60] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_60] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_60] at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.elements(OrientGraphStep.java:89) ~[orientdb-gremlin-3.2.1.1.jar:?] at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.edges(OrientGraphStep.java:51) ~[orientdb-gremlin-3.2.1.1.jar:?] at org.apache.tinkerpop.gremlin.orientdb.traversal.step.sideEffect.OrientGraphStep.lambda$new$0(OrientGraphStep.java:39) ~[orientdb-gremlin-3.2.1.1.jar:?] at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:136) ~[gremlin-core-3.2.1.jar:3.2.1] at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:128) ~[gremlin-core-3.2.1.jar:3.2.1] at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:38) ~[gremlin-core-3.2.1.jar:3.2.1] at org.apache.tinkerpop.gremlin.process.traversal.Traversal.fill(Traversal.java:146) ~[gremlin-core-3.2.1.jar:3.2.1] at org.apache.tinkerpop.gremlin.process.traversal.Traversal.toList(Traversal.java:103) ~[gremlin-core-3.2.1.jar:3.2.1] at gremlin.scala.GremlinScala.toList(GremlinScala.scala:28) ~[gremlin-scala_2.11-3.2.1.0.jar:3.2.1.0] at gremlin.scala.GremlinScala.headOption(GremlinScala.scala:37) ~[gremlin-scala_2.11-3.2.1.0.jar:3.2.1.0] at gremlin.scala.GremlinScala.exists(GremlinScala.scala:41) ~[gremlin-scala_2.11-3.2.1.0.jar:3.2.1.0]

luizmiranda7 commented 7 years ago

I have the same issue here, any idea when Composite index will be supported?

christinedraper commented 7 years ago

I have encountered the same problem when running using an in-memory database. However, the composite index seems to work (with some caveats #126) when running against a remote database. (