Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Payload class, SQL query, OR operation

Hi,

I have a class like this:

public class TestEntry extends MetaDataEntry { public Integer id; public String value; public Integer type; public TestPayload payload; }

I found that if I include any OR operation in a SQLQuery, the returned result of read or readMultiple is not correct.

For example if I do:

SQLQuery<testentry> sq = new SQLQuery<testentry>(temp, "(id =2 or id =3)");

space.readMultiple(sq, null, 2);

Even if there are objects that satisfy the conditions in the space, it will return me nothing.

However, if I remove leave the payload object as null when I write the object, or if I don't have the payload object inside TestEntry at all, or if I put all the fields in TestPayload inside TestEntry, then it will work properly.

Looks like when there is payload class involved, SQLQuery only does simple query type of things.

However, I believe including not searchable fields into a payload class will yield better performance.

I am not sure whether this is a bug on the GS side or there is something I can set / configure on my side.

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2681]{quote}

asked 2008-11-02 22:23:37 -0500

jye gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Comments/questions:
- Which release you are using? This sounds as a problem that has been fixed with latest releases.
- Can u place the class name instead a template object as the first argument to the SQLQuery constructor and try?
- Do you have the TestPayload as q separate class or is it declared as an embedded class within TestEntry? Having it as a separate class will save some memory. The inner embedded class object must have its parent object to be instanciated when stored in the space together with the actual space entry object that stores the entry data.
- OR based queries with the Space API are parsed at the client side and sent to the space separately (each condition evaluated separately). U will have better performance with using executors and a query service that will perform the query colocated with space. This will avoid the remote call done with every condition.

Shay

answered 2008-11-03 04:01:19 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi Shay, thanks for your replay. And regarding your questions:

* Which release you are using? This sounds as a problem that has been fixed with latest releases?

  We are using GigaSpaces-EDG-6.5.1-GA


* Can u place the class name instead a template object as the first argument to the SQLQuery constructor and try?

  We tried that. It is the same thing.


* Do you have the TestPayload as q separate class or is it declared as an embedded class within TestEntry? Having it as a separate class will save some memory. The inner embedded class object must have its parent object to be instanciated when stored in the space together with the actual space entry object that stores the entry data.

  TestPayload is a separate class, not an inner class.


* OR based queries with the Space API are parsed at the client side and sent to the space separately (each condition evaluated separately). U will have better performance with using executors and a query service that will perform the query colocated with space. This will avoid the remote call done with every condition.

  We actually found that if OR is the last operation, then it seems to work. For example, (id=? OR id=?) AND (type=?) won't work. But (id=? AND type=?) OR (id=? type=?) works.
jye gravatar imagejye ( 2008-11-06 15:32:00 -0500 )edit

The weird thing is that if there is no payload or payload is null, then it will work properly. So this looks like a GS bug to us.

And regarding your explanation of how OR works, is it the same for >, <, <>?

Edited by: jye on Nov 6, 2008 3:36 PM

jye gravatar imagejye ( 2008-11-06 15:34:28 -0500 )edit

, <, <> are handled differently.

These are send to the space using one native space template and are not broken into multiple calls.

Can you provide a simple test case?

I believe something similar been fixed recently.

We should check this with 6.6.1.

Shay

shay hassidim gravatar imageshay hassidim ( 2008-11-06 16:00:53 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-11-02 22:23:37 -0500

Seen: 45 times

Last updated: Nov 03 '08