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

Incorrect work of 'SELECT' query #7322

Closed
schernolyas opened this issue Apr 9, 2017 · 18 comments
Closed

Incorrect work of 'SELECT' query #7322

schernolyas opened this issue Apr 9, 2017 · 18 comments
Assignees
Labels
Milestone

Comments

@schernolyas
Copy link

OrientDB Version: 3.0.0-SNAPSHOT

Java Version: 1.8

OS: Ubuntu

Try to execute query "SELECT FROM ProductType WHERE id="74326f5e-ca9f-4e29-9e2c-a87da69e6f90""

Expected behavior

returns no documents.

Actual behavior

Returns: {"@type":"d","@Rid":"#25:-5","@Version":0,"@Class":"ProductType","description":"vegetables","id":"99246056-882f-4ba4-8d3d-44543e8bc7ef"}

Steps to reproduce

During transactions add document and try to search the document.

@tglman
Copy link
Member

tglman commented Apr 11, 2017

hi @schernolyas,

which API did you use for do the transaction ? this look quite strange, a snippet of code of example may help to solve the problem.

Regards

@luigidellaquila
Copy link
Member

oh... do you have an index on ID property? Probably it's a bug in the execution planner.

Could you please post the result of an EXPLAIN?

Thanks

Luigi

@schernolyas
Copy link
Author

Hi @luigidellaquila !

Yes of course! field 'id' is primary key (field with unique index). In current case, field's type is String.

About explain ... okey I recall query

@schernolyas
Copy link
Author

schernolyas commented Apr 11, 2017

@luigidellaquila , please, see to explain.

explain document :

{"@type":"d","@version":0,"executionPlan":{"@type":"d","@version":0,"cost":0,"prettyPrint":"+ FETCH FROM INDEX ProductTypePK\u000a  id = '43b6ed8f-3b20-42aa-a279-6294ae22b134'\u000a+ EXTRACT VALUE FROM INDEX ENTRY\u000a+ FILTER ITEMS BY CLASS \u000a  ProductType","type":"QueryExecutionPlan","steps":[{"@type":"d","@version":0,"cost":0,"subSteps":[],"name":"FetchFromIndexStep","description":"+ FETCH FROM INDEX ProductTypePK\u000a  id = '43b6ed8f-3b20-42aa-a279-6294ae22b134'","type":"FetchFromIndexStep","targetNode":"FetchFromIndexStep","javaType":"com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep","@fieldTypes":"cost=l"},{"@type":"d","@version":0,"cost":-1,"subSteps":[],"name":"GetValueFromIndexEntryStep","description":"+ EXTRACT VALUE FROM INDEX ENTRY","type":"GetValueFromIndexEntryStep","targetNode":"GetValueFromIndexEntryStep","javaType":"com.orientechnologies.orient.core.sql.executor.GetValueFromIndexEntryStep","@fieldTypes":"cost=l"},{"@type":"d","@version":0,"cost":-1,"subSteps":[],"name":"FilterByClassStep","description":"+ FILTER ITEMS BY CLASS \u000a  ProductType","type":"FilterByClassStep","targetNode":"FilterByClassStep","javaType":"com.orientechnologies.orient.core.sql.executor.FilterByClassStep","@fieldTypes":"cost=l"}],"javaType":"com.orientechnologies.orient.core.sql.executor.OSelectExecutionPlan","@fieldTypes":"cost=l,steps=z"},"executionPlanAsString":"+ FETCH FROM INDEX ProductTypePK\u000a  id = '**43b6ed8f-3b20-42aa-a279-6294ae22b134**'\u000a+ EXTRACT VALUE FROM INDEX ENTRY\u000a+ FILTER ITEMS BY CLASS \u000a  ProductType"}

query:

result: {"@type":"d","@rid":"#25:-5","@version":0,"@class":"ProductType","description":"vegetables","id":"**bf4884b6-7cc0-4eed-b012-e34c49fa699a**"}

@luigidellaquila
Copy link
Member

Thank you very much @schernolyas

Ok, the execution plan is correct, the problem is somewhere else.
@tglman the only involved component here is the index, so the problem should be there.

Thanks

Luigi

@schernolyas
Copy link
Author

Hi @luigidellaquila !

Make OrientDB better :)

@tglman
Copy link
Member

tglman commented Apr 12, 2017

hi,

fixed and added the test case

Thanks for the report and the early testing, really appreciate.

Regards

@luigidellaquila
Copy link
Member

Great @tglman !

@tglman tglman closed this as completed Apr 12, 2017
@schernolyas
Copy link
Author

Hi @tglman and @luigidellaquila !

A lot of thanks! I pull last changes and recheck!

@schernolyas
Copy link
Author

Sorry collegues!

Not fixed.
[main] 18:43:22,031 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBEntityQueries: entity by primary key EntityKey(ProductType) [id=3dc1fabf-540e-43c6-a1ce-fc1b45a46e72] found! Is it temporary entity? true ; Is it new entity? true ; document :{"@type":"d","@Rid":"#25:-5","@Version":0,"@Class":"ProductType","description":"vegetables","id":"50ed8b7a-d842-41bd-af91-10096b9af8f0"}

I pull last commits:


osboxes@osboxes:~/NetBeansProjects/orientdb$ git log -n 3
commit f5424aa
Author: Roberto Franchini [email protected]
Date: Wed Apr 12 14:25:18 2017 +0200

updates release date

commit 6255c91
Author: Tglman [email protected]
Date: Wed Apr 12 13:11:21 2017 +0100

fixed bug for transaction index changes iteration in case of missing value, issue #7322

commit 47740ef
Author: laa [email protected]
Date: Wed Apr 12 10:40:52 2017 +0300

Issue with incorrect cluster names stored in configuration was fixed

[main] 18:43:22,038 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBEntityQueries: explain document :{"@type":"d","@Version":0,"executionPlan":{"@type":"d","@Version":0,"cost":0,"prettyPrint":"+ FETCH FROM INDEX ProductTypePK\u000a id = '3dc1fabf-540e-43c6-a1ce-fc1b45a46e72'\u000a+ EXTRACT VALUE FROM INDEX ENTRY\u000a+ FILTER ITEMS BY CLASS \u000a ProductType","type":"QueryExecutionPlan","steps":[{"@type":"d","@Version":0,"cost":0,"subSteps":[],"name":"FetchFromIndexStep","description":"+ FETCH FROM INDEX ProductTypePK\u000a id = '3dc1fabf-540e-43c6-a1ce-fc1b45a46e72'","type":"FetchFromIndexStep","targetNode":"FetchFromIndexStep","javaType":"com.orientechnologies.orient.core.sql.executor.FetchFromIndexStep","@fieldTypes":"cost=l"},{"@type":"d","@Version":0,"cost":-1,"subSteps":[],"name":"GetValueFromIndexEntryStep","description":"+ EXTRACT VALUE FROM INDEX ENTRY","type":"GetValueFromIndexEntryStep","targetNode":"GetValueFromIndexEntryStep","javaType":"com.orientechnologies.orient.core.sql.executor.GetValueFromIndexEntryStep","@fieldTypes":"cost=l"},{"@type":"d","@Version":0,"cost":-1,"subSteps":[],"name":"FilterByClassStep","description":"+ FILTER ITEMS BY CLASS \u000a ProductType","type":"FilterByClassStep","targetNode":"FilterByClassStep","javaType":"com.orientechnologies.orient.core.sql.executor.FilterByClassStep","@fieldTypes":"cost=l"}],"javaType":"com.orientechnologies.orient.core.sql.executor.OSelectExecutionPlan","@fieldTypes":"cost=l,steps=z"},"executionPlanAsString":"+ FETCH FROM INDEX ProductTypePK\u000a id = '3dc1fabf-540e-43c6-a1ce-fc1b45a46e72'\u000a+ EXTRACT VALUE FROM INDEX ENTRY\u000a+ FILTER ITEMS BY CLASS \u000a ProductType"}

@schernolyas
Copy link
Author

Hi @luigidellaquila !
Sorry ... but bug reproduced :-(

@tglman tglman reopened this Apr 12, 2017
@lvca lvca assigned luigidellaquila and unassigned tglman Apr 14, 2017
@lvca lvca added the bug label Apr 14, 2017
@lvca lvca added this to the 3.0 milestone Apr 14, 2017
luigidellaquila added a commit that referenced this issue Apr 18, 2017
@luigidellaquila
Copy link
Member

Hi @schernolyas

I just pushed another fix on develop branch, it should cover all the cases.
Please let me know if it solves the problem

Thanks

Luigi

@schernolyas
Copy link
Author

HI @luigidellaquila !
A lot of thanks! I will retest.

@schernolyas
Copy link
Author

Hi @luigidellaquila !
I have tested. I see that we have a progress. But ... I get exception in other place. I will analyse and details.

@luigidellaquila
Copy link
Member

luigidellaquila commented Apr 18, 2017

Hi @schernolyas

Is the new exception still related to this specific problem? Can I close this issue?

Thanks

Luigi

@schernolyas
Copy link
Author

@luigidellaquila
Exception is:

ORecordDuplicatedException: Cannot index record #35:0: found duplicated key '1' in index 'BuyingOrderPK' previously assigned to the record #33:0
DB name="ogm_test_database" INDEX=BuyingOrderPK RID=#33:0

But ... Why? .... Get me a time for analysis... Full stack trace in attached file.

org.hibernate.ogm.datastore.orientdb.test.jpa.OrientDbAssociationTest-output.txt

@schernolyas
Copy link
Author

Hi @luigidellaquila !

I have investigaed exception from my last message. It it my exception.

A lot of thanks for support!

@luigidellaquila
Copy link
Member

Thanks for the feedback @schernolyas !

Luigi

@santo-it santo-it added this to the 3.0.0-M2 milestone Apr 26, 2017
@santo-it santo-it removed this from the 3.0 milestone Apr 26, 2017
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

5 participants