You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE CLASS Task extends V
CREATE PROPERTY Task.projectId STRING (MANDATORY TRUE, NOTNULL, MAX 20)
CREATE PROPERTY Task.seq SHORT ( MANDATORY TRUE, NOTNULL, MIN 0)
CREATE INDEX TaskPK ON Task (projectId, seq) UNIQUE
I performed a query in "wrong" (not index) order (yeah, I don't intend for it to stay this way)
OrientDb decides to use index here anyway. That would not be a problem, except that the order or keys is switched. This causes orientdb to try to cast taskId to String, and projectId to Short. That obviously causes the error.
Querry works perfectly after changing the order of parameters. graph.getVertices(Task.CLASS, arrayOf(Task.SEQ, Task.PROJECT_ID), arrayOf(taskId.projectId, taskId.seq))
In my original code, I will switch the order of Ikeys to correspond to Index, so that is not a problem for me in the slightest. I just wanted to share with you this oddity.
This would be bad if both of my parameters were of type string - then It would cause strange querry results, and would make the problem hard to pinpoint. I would better have an exception instead of this weird result.
Problem is here:
Set<OIndex<?>> indexes = clazz.getInvolvedIndexes(Arrays.asList(iKey)); //finds index correctly
Iterator<OIndex<?>> iterator = indexes.iterator(); // iterate over it randomly, not caring about order of parameters
while (iterator.hasNext()) {
...
List<Object> keys = Arrays.asList(convertKeys(idx, iValue)); //and cast (the place that originally have thrown the error)
...
Steps to reproduce
I will branch out my project if anyone finds this worth investigating.
The text was updated successfully, but these errors were encountered:
karolmie1
changed the title
Reversed order of params in graph.getVertices
Trouble with order of params in graph.getVertices when using index
Apr 27, 2017
OrientDB Version: 2.2.18
Java Version: 8
OS: linux
Expected behavior
I perform a query for Tasks. Task is created as:
I performed a query in "wrong" (not index) order (yeah, I don't intend for it to stay this way)
graph.getVertices(Task.CLASS, arrayOf(Task.SEQ, Task.PROJECT_ID), arrayOf(taskId.seq, taskId.projectId))
OrientDb decides to use index here anyway. That would not be a problem, except that the order or keys is switched. This causes orientdb to try to cast taskId to String, and projectId to Short. That obviously causes the error.
Querry works perfectly after changing the order of parameters.
graph.getVertices(Task.CLASS, arrayOf(Task.SEQ, Task.PROJECT_ID), arrayOf(taskId.projectId, taskId.seq))
In my original code, I will switch the order of Ikeys to correspond to Index, so that is not a problem for me in the slightest. I just wanted to share with you this oddity.
This would be bad if both of my parameters were of type string - then It would cause strange querry results, and would make the problem hard to pinpoint. I would better have an exception instead of this weird result.
Problem is here:
Steps to reproduce
I will branch out my project if anyone finds this worth investigating.
The text was updated successfully, but these errors were encountered: