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
Traversal of a property will only traverse that property
Actual behavior
Unpredictable traversal is happening.
Steps to reproduce
1. Create Classes
CREATE CLASS Model;
CREATE PROPERTY Model.id String;
CREATE CLASS DataValue;
CREATE PROPERTY DataValue.id String;
CREATE CLASS ObjectValue EXTENDS DataValue;
CREATE PROPERTY ObjectValue.children LINKMAP DataValue;
CREATE CLASS ArrayValue EXTENDS DataValue;
CREATE PROPERTY ArrayValue.children LINKLIST DataValue;
CREATE CLASS StringValue EXTENDS DataValue;
CREATE PROPERTY StringValue.value String;
CREATE PROPERTY DataValue.model LINK Model;
CREATE PROPERTY Model.data LINK ObjectValue;
2. Create Data
LET model =INSERT INTO Model SET id ="model";
LET objectString =INSERT INTO StringValue SET id="objectString", model=$model[0], value="objectString";
LET arrayString =INSERT INTO StringValue SET id="arrayString", model=$model[0], value="arrayString";
LET objectChild =INSERT INTO ObjectValue SET id="objectChild", model=$model[0], children={};
LET arrayChild =INSERT INTO ArrayValue SET id="arrayChild", model=$model[0], children=[];
LET stringChild =INSERT INTO StringValue SET id="stringChild", model=$model[0], value="stringChild";
LET root =INSERT INTO ObjectValue SET id="root", model=$model[0], children={};
UPDATE ObjectValue SETchildren.objectChild= $objectChild[0] WHERE id ="root";
UPDATE ObjectValue SETchildren.arrayChild= $arrayChild[0] WHERE id ="root";
UPDATE ObjectValue SETchildren.stringChild= $stringChild[0] WHERE id ="root";
UPDATE ObjectValue SETchildren.objectString= $objectString[0] WHERE id ="objectChild";
UPDATE ArrayValue SET children = [$arrayString[0]] WHERE id ="arrayChild";
UPDATE Model SET data = $root[0];
3. Inspect results
Step 1
Just SELECT the data.
SELECTFROM DataValue;
We see all of the DataValues properly created.
Step 2
Try to traverse all children from the root ObjectValue.
TRAVERSE children FROM (SELECTFROM DataValue WHERE id ="root");
As mentioned in #9099, this will not traverse the root elements children LINKMAP.
Step 3
Try to traverse using children.values() from the root ObjectValue.
TRAVERSE children.values() FROM (SELECTFROM DataValue WHERE id ="root");
The traversal through the LINKMAP works. But there are two issues. First, why do we have the Model object in the traversal? It is not traversable via the children property. Also, the arrayString value which is a child of the arrayChild ArrayValue is missing.
Step 4
Since there seems to be something odd with the ArrayValue, try to traverse using children.values() from the arrayChild ArrayValue.
TRAVERSE children.values() FROM (SELECTFROM DataValue WHERE id ="arrayChild");
Here we directly see that the Model is coming from the traversal of the ArrayValue. And that the ArrayValue's children are not properly being traversed.
Step 5
Let's just verify that a traversal of the normal children properly will work from the arrayChild.
TRAVERSE children FROM (SELECTFROM DataValue WHERE id ="arrayChild");
The Model is gone and we do get the StringValue.
Step 6
Try traversing on both children and children.values() from the root;
TRAVERSE children, children.values() FROM (SELECTFROM DataValue WHERE id ="root");
Now we get all the values we WANT, but we are still incorrectly getting the Model.
Step 7
Use an additional SELECT to filter on the DataValue class.
SELECTFROM (TRAVERSE children, children.values() FROM (SELECTFROM DataValue WHERE id ="root")) WHERE @class INSTANCEOF "DataValue";
Now we finally get what we wanted.
4. Discussion
This seems a bit messy, and probably a bit inefficient. We have multiple projections, and an extra SELECT. Fixing #9099, may avoid this problem because we would not have to call .values() in the first place. But this still seems like a bug.
The text was updated successfully, but these errors were encountered:
mmacfadden
added a commit
to convergencelabs/convergence-server
that referenced
this issue
Jan 1, 2020
OrientDB Version: 3.0.26
Java Version: OpenJDK 11
OS:Linux
Expected behavior
Traversal of a property will only traverse that property
Actual behavior
Unpredictable traversal is happening.
Steps to reproduce
1. Create Classes
2. Create Data
3. Inspect results
Step 1
Just SELECT the data.
We see all of the DataValues properly created.
Step 2
Try to traverse all children from the root ObjectValue.
As mentioned in #9099, this will not traverse the root elements
children
LINKMAP.Step 3
Try to traverse using
children.values()
from the root ObjectValue.The traversal through the LINKMAP works. But there are two issues. First, why do we have the
Model
object in the traversal? It is not traversable via thechildren
property. Also, thearrayString
value which is a child of thearrayChild
ArrayValue is missing.Step 4
Since there seems to be something odd with the ArrayValue, try to traverse using
children.values()
from the arrayChild ArrayValue.Here we directly see that the
Model
is coming from the traversal of the ArrayValue. And that the ArrayValue's children are not properly being traversed.Step 5
Let's just verify that a traversal of the normal
children
properly will work from thearrayChild
.The
Model
is gone and we do get the StringValue.Step 6
Try traversing on both
children
andchildren.values()
from the root;Now we get all the values we WANT, but we are still incorrectly getting the
Model
.Step 7
Use an additional SELECT to filter on the DataValue class.
Now we finally get what we wanted.
4. Discussion
This seems a bit messy, and probably a bit inefficient. We have multiple projections, and an extra SELECT. Fixing #9099, may avoid this problem because we would not have to call
.values()
in the first place. But this still seems like a bug.The text was updated successfully, but these errors were encountered: