OrientDB 1.6.1-hotfix: Regression on fetchPlan
Hi, Yesterday I downloaded the latest OrientDB 1.6.1-hotfix branch and tested it. I think I found a regression on the fetchPlan parameter to use with ODocument.toJson()
Scenario: I have a class like this:
orientdb> desc _bb_user
Class................: _BB_User
Super class..........: _BB_Node
Default cluster......: _bb_user (id=13)
Supported cluster ids: [13]
Properties:
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+
NAME | TYPE | LINKED TYPE/CLASS | MANDATORY | READONLY | NOT NULL | MIN | MAX |
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+
visibleByTheUser | LINK | _BB_UserAttributes | false | false | false | | |
visibleByFriend | LINK | _BB_UserAttributes | false | false | false | | |
user | LINK | OUser | true | false | true | | |
_audit | EMBEDDED | null | false | false | false | | |
visibleByAnonymousUsers | LINK | _BB_UserAttributes | false | false | false | | |
visibleByRegisteredUsers | LINK | _BB_UserAttributes | false | false | false | | |
_links | LINK | _BB_NodeVertex | true | false | true | | |
_creation_date | DATETIME | null | true | false | true | | |
id | STRING | null | false | false | false | | |
_allowUpdate | LINKSET | OIdentity | false | false | false | | |
_allowDelete | LINKSET | OIdentity | false | false | false | | |
_allow | LINKSET | OIdentity | false | false | false | | |
_allowRead | LINKSET | OIdentity | false | false | false | | |
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+
Please note that the user property is a link to the OUser class. In OrientDB 1.6.0 (and previous versions too) if I perform the following statement, I obtain this result:
orientdb> select @this.toJson("fetchPlan:user.password:-2 user.roles.name:1 user.roles.inheritedRole:-2 user.roles.rules:-2 user.roles:0 _creation_dat
e:-2 visibleByAnonymousUsers:1 visibleByTheUser:1 visibleByFriend:1 visibleByRegisteredUsers:1 _links:-2 _audit:-2 system:-2 _allow:-2 _allowRead:-2,i
ndent:0") from _bb_user where user.name="admin"
----+-----+--------------------------------------------------------------------------------------------------------------------------
# |@RID |this
----+-----+--------------------------------------------------------------------------------------------------------------------------
0 |#-2:1|{"user":{"name":"admin","status":"ACTIVE","roles":[{"name":"administrator","mode":1,"internal":true,"modifiable":false,...
----+-----+--------------------------------------------------------------------------------------------------------------------------
Note how the roles property is serialized. Now with the 1.6.1 version the same select returns:
orientdb> select @this.toJson("fetchPlan:user.password:-2 user.roles.name:1 user.roles.inheritedRole:-2 user.roles.rules:-2 user.roles:0 _creation_dat
e:-2 visibleByAnonymousUsers:1 visibleByTheUser:1 visibleByFriend:1 visibleByRegisteredUsers:1 _links:-2 _audit:-2 system:-2 _allow:-2 _allowRead:-2,i
ndent:0") from _bb_user where user.name="admin"
----+-----+-----------------------------------------------------------------------------------------------
# |@RID |this
----+-----+-----------------------------------------------------------------------------------------------
0 |#-2:1|{"user":{"name":"admin","status":"ACTIVE","roles":["#4:0"]},"signUpDate":"2013-09-05 17:22:29"}
----+-----+-----------------------------------------------------------------------------------------------
The roles property is not serialized properly.
- 1.6.0: "roles":[{"name":"administrator"
- 1.6.1: ,"roles":["#4:0"
@enisher can this be a consequence of your last change in fetch plans?
The regression is caused by this modification on the OFetchHelper.java https://github.com/orientechnologies/orientdb/commit/93cc539baeefb1da454d622b335984804fb7a377 line 191 !iFetchPlan.containsKey(fieldPath.toUpperCase() instead of !iFetchPlan.containsKey(fieldPath)
Yea, you are right. This is because usage of fetch plan from different places are inconsistent. I thought fetchPlan should be case insensitive. Will fix.
Fixed by 7648bdf312f71a0470f5134e4e71841d8b666d79
Is this fix going to be relased with a hotfix update?