Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create edge with same subquery between from and to use position params, result is wrong #8809

Closed
robinZhao opened this issue Mar 10, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@robinZhao
Copy link

robinZhao commented Mar 10, 2019

OrientDB Version: <3.0.17>

Java Version: <1.8.0_172>

OS: <windows 10>

Expected behavior

public class TestOrientClient {
    public static void main(String[] args){
        OrientDB orientDB = new OrientDB("remote:localhost/test", OrientDBConfig.defaultConfig());
        try(ODatabaseSession db = orientDB.open("test","root","root");) {
            // Enter your code here...
            db.begin(OTransaction.TXTYPE.OPTIMISTIC);
            db.command("create edge friends from (select from person where name=?) to (select from person where name=?)","tom","green");
            db.commit();
        }
    }
}

exist data in person class

+----+-----+------+-----+----+----+
|#   |@RID |@CLASS|name |age |id  |
+----+-----+------+-----+----+----+
|0   |#45:0|person|tom  |16  |1   |
|1   |#46:0|person|green|16  |1   |
+----+-----+------+-----+----+----+

result should be:

+----+-----+-------+-----+-----+
|#   |@RID |@CLASS |out  |in   |
+----+-----+-------+-----+-----+
|0   |#49:0|friends|#45:0|#46:0|
+----+-----+-------+-----+-----+

Actual behavior

+----+-----+-------+-----+-----+
|#   |@RID |@CLASS |out  |in   |
+----+-----+-------+-----+-----+
|0   |#49:0|friends|#45:0|#45:0|
+----+-----+-------+-----+-----+

this is a wrong result

I think this is due to command caching

Steps to reproduce


orientdb {db=test}> create class person extends V;
orientdb {db=test}> create class friends extends E;
orientdb {db=test}> insert into person (name,age,id) values ('tom',16,1);
orientdb {db=test}> insert into person (name,age,id) values ('green',16,1);
try(ODatabaseSession db = orientDB.open("test","root","root");) {
            // Enter your code here...
            db.begin(OTransaction.TXTYPE.OPTIMISTIC);
            db.command("create edge friends from (select from person where name=?) to (select from person where name=?)","tom","green");
            db.commit();
        }
@robinZhao robinZhao changed the title create edge with same subquery between from and to use position params, result is unexpected create edge with same subquery between from and to use position params, result is wrong Mar 10, 2019
@luigidellaquila
Copy link
Member

Hi @robinZhao

Thank you for reporting, it could be a problem with the query execution plan caching, I'm checking it now.
In the meantime, you can work-around it using named parameters

Thanks

Luigi

@luigidellaquila luigidellaquila self-assigned this Mar 11, 2019
luigidellaquila added a commit that referenced this issue Mar 11, 2019
(too much aggressive usage of the execution plan cache)

Resolves: #8809
@luigidellaquila
Copy link
Member

Hi @robinZhao

I managed to reproduce and fix the problem, the fix will be released with v 3.0.18

Thanks

Luigi

@luigidellaquila luigidellaquila added this to the 3.0.18 milestone Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants